我想使用if语句比较 Bash 中的字符串,但它不起作用:
if
#!/bin/bash os=`lsb_release -r | sed 's/.*://'` echo $os if [ $os="16.04" ] then echo "g" elif [ $os="14.04" ] then echo "b" else echo "c" fi
command-line bash
bash ×1
command-line ×1