所以下面是我在我的bash脚本中的代码。我收到一个错误,说二元运算符预期当我给命令2个参数(不给错误,当我给1个参数)。它会改变文件权限,当我给出2个参数,因为我可以看到它时,我做ls -l但它仍然给我这个错误。我如何解决它?Unix bash错误 - 二元运算符预计
for file in [email protected]
do
chmod 755 $file
done
if [ -z [email protected] ]
then
echo "Error. No argument."
exit $ERROR_CODE_1
fi
我已经加入此现在
if [ ! -f "$*" ]
then
echo "Error. File does not exist"
exit $ERROR_NO_FILE
fi
但现在当我输入超过1种说法只是做一切if语句(即打印error.file不存在),即使文件确实存在。
不要更改您的问题。如果你有一个*新的问题,你应该把它作为一个新的,而不是改变你现有的*问题。 – andlrc