linux - 输出保持不变

标签 linux bash

无论输入如何,输出都保持“Dead,ciao in hell”

<---Begin Code--->
echo "Which wire to cut? Red or Green? "
read die
if [[ die = "red" ]]; then
echo "You are saved!"
else echo "Dead,ciao in hell"
fi
<---End COde--->

有人能帮帮我吗?

谢谢!

最佳答案

你在死亡时错过了 $ 符号

echo "Which wire to cut? Red or Green? "
read die
if [[ $die = "red" ]]; then
echo "You are saved!"
else echo "Dead,ciao in hell"
fi

输出

Which wire to cut? Red or Green? 
asd
Dead,ciao in hell
Which wire to cut? Red or Green? 
red
You are saved!

关于linux - 输出保持不变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39306774/

相关文章:

linux - 使用 bash 命令删除下一行、空格

使用 Slony-I 替代 Linux 设置到 Shell 脚本的数据库复制

linux - 在终止进程之前保存 gmon.out

linux - 如何使用 autossh 获得持久的反向 SSH 隧道?

mysql - OS X : Keep commands working in terminal

linux - 如何获取 zip 中的目录列表?

linux - 一口气重命名linux中的所有文件

linux - 将毫秒添加到时间戳(bash,unix)

linux - 允许 Nagios 报告其他两台 Linux 机器之间的 ping 的 Bash 脚本

linux - 我如何 'nohup' 命令并记录 'time' 的输出