linux - 使用 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
,而是如上所示
提前致谢
解决方案
推荐阅读
- reactjs - 在使用状态不工作的 React 组件内切换值
- discord - 如何让机器人在触发词后保存消息(discord.py)
- android - 解锁 Android Studio 中的 APK 文件以进行编辑
- json - VB.Net - 从现有 JObject 中的属性子集创建 JObject
- javascript - 用逗号格式化整数 JavaScript
- python - 如何格式化具有多个类别的时间序列数据和与每个类别相关的数值数据以输入到 Tensorflow 模型中?
- android - 嘿,这里是初学者
- sql - 优雅地总结 AWS Athena 中的多个列,不包括空值
- spyder - 当我按下空格键 Spyder-IDE 时出现奇怪的点
- javascript - 如何修复我的 Mturk 提交按钮?它不工作