我正在开发简单的 shell 脚本,它将我当前的所有目录文件复制到将存在于当前工作目录中的备份目录中。现在,当我在if中传递一个以上的条件时,我得到了错误。
#!/bin/bash
filename=nx.pdf
for i in *;
do
echo $i;
if [ $i == backup || $i == $filename ] ; then
echo "Found backup."
else
echo "Part 2"
cp -rf $i backup
fi
done
我收到错误
asd.sh: line 6: [: missing `]'
asd.sh: line 6: ==: command not found
Part 2
deployee.sh
asd.sh: line 6: [: missing `]'
asd.sh: line 6: ==: command not found
Part 2