shell脚本中的if和&&概念

时间:2019-03-25 23:04:01

标签: shell

我是Shell脚本的新手,我正在尝试运行简单的代码

test.sh文件的输入将是input1和input2(例如../test_script.sh input1 input2)

#!/bin/bash
export a=$1
export b=$2
if ["$a" -eq ''] && ["$b" -eq '']
then
echo "Please enter an input"
elif ["$a"] && ["$b" -eq '']
then
echo "the value of a is $a"
elif ["$a"] && ["$b"]
then
echo "The value of a is $a and b is $b"
else
print "Something went wrong "

fi

此语法是否正确,因为我遇到了错误,需要帮助以查找我要去哪里

 ./test.sh 10 11
 ./test.sh: line 5: [10: command not found
 ./test.sh: line 10: [10]: command not found
 ./test.sh: line 14: [10]: command not found
 ./test.sh: line 19: print: command not found

0 个答案:

没有答案