我正在尝试使用bash脚本代码在php版本之间切换,但是我收到以下消息错误:
Which PHP version would you like to enable?
php5.6
Module php5.6 already disabled
Module php7.1 already disabled
Module php7.2 already disabled
Enabling...
ERROR: Module does not exist!
我的代码:
#!/bin/bash
echo "Which PHP version would you like to enable?";
read $version;
sudo a2dismod php5.6;
sudo a2dismod php7.1;
sudo a2dismod php7.2;
echo "Enabling...";
sudo a2enmod "$version";
systemctl restart apache2;
答案 0 :(得分:0)
我建议从$
删除read $version
。
在为变量分配内容时,请勿使用$
。