我正在尝试创建一个脚本来将输入的字符串与空值进行比较。逻辑有效,但我一直收到以下错误:
./demo.sh:第 13 行:[[/var:没有此文件或目录
下面是令我困惑的代码块:
read -p "Hello, please enter the target installation path: [/opt] " depl
echo "You have chosen to deploy in $depl"
echo "Now deploying in $depl..."
if [[$depl == ""]];
then
echo "Invalid input, cannot write to root!"
else
sleep 2
mkdir $depl/new
echo "Deployment complete!"
fi
我尝试将目标输入添加到 $PATH,但没有帮助。其他一切都运行正常,但我只是不明白为什么会抛出此错误。任何见解都将不胜感激!