首页 > 解决方案 > 使用 bash 脚本中的命令注销

问题描述

我正在尝试编写一个执行以下操作的 bash 脚本:

#!/bin/bash
echo "hello World"

while [ true ] 
do
echo "Do you want to logout? [Yes]/[No]"
read x
if [ "$x" = "Yes" ]
  # here should come the logout command
else
  exit;
fi
done

我来了 exec,但是我不想要带有 的选项exec ./myScript.sh,而是如上所示

提前致谢

标签: linuxbashshellubuntu

解决方案


推荐阅读