【问题标题】:Unix Script Showing "Command Not Found" When Reading [duplicate]读取时显示“找不到命令”的 Unix 脚本 [重复]
【发布时间】:2020-01-26 21:16:37
【问题描述】:
echo "Enter the current time: "

read h m s

s = `expr $n + 1`

if [ $n -eq 60 ]; then

    s = 0
    m = `expr $m + 1`

    if [ $m -eq 60 ]; then

        m = 0
        h = `expr $h + 1`

        if [ $h -eq 24 ]; then
             h = 0
        fi
    fi
fi

echo "The time after one second is $h $m $n"

【问题讨论】:

    标签: linux bash shell ubuntu unix


    【解决方案1】:

    如果您在 bash 提示符中键入 s = 0,您将得到 bash: s: command not found

    在 bash 中分配变量的正确方法是 s=0 不带空格。

    【讨论】:

      猜你喜欢
      • 2015-08-01
      • 1970-01-01
      • 2017-11-21
      • 1970-01-01
      • 1970-01-01
      • 2013-03-18
      • 2020-10-10
      • 2014-03-18
      • 2019-12-26
      相关资源
      最近更新 更多