小编Zac*_*man的帖子

撰写案例陈述

#!/bin/bash
until [read command -eq "end"]
do
echo What command would like to run?
read command
if [$command -eq "my-tweets"]; then
node liri.js $command
fi
if [$command -eq "do-what-it-says"];then
node liri.js $command
fi
if [$command -eq "spotify-this-song"]; then
echo What item would like to query?
read item
node liri.js $command $item
fi
if [$command -eq "movie-this"]; then
echo What item would like to query?
read item
node liri.js $command $item
fi
done
Run Code Online (Sandbox Code Playgroud)

我正在尝试创建一个 case/if 语句来在运行代码的下一部分之前检查变量的值。我想根据用户输入的值检查$command创建此 case/if 语句的值。我不断收到命令未找到错误。

bash if-statement case-statement switch-statement

5
推荐指数
1
解决办法
5731
查看次数