我在bash中有这段代码
#!/bin/bash
echo "php version"
read NAME
if ["$NAME" = "5.6"]
then
sudo a2dismod php7.1
sudo a2enmod php5.6
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php5.6
else
sudo a2dismod php5.6
sudo a2enmod php7.1
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.1
fi
但问题是,如果我不按预期工作,因为当我跑步时
./enphp.sh
我收到了这个错误:
/home/irebega/bash/enphp.sh: line 4: [5.6: command not found