看了前一個(gè)同學(xué)的才知道 if與[
[和 "$test" 是有空格的。
我說怎么老是錯(cuò)誤呢!
加油加油 作為一個(gè)這菜鳥努力
[和 "$test" 是有空格的。
我說怎么老是錯(cuò)誤呢!
加油加油 作為一個(gè)這菜鳥努力
2015-08-17
#!/bin/bash
test=$(env|grep "USER"|cut -d "=" -f 2)
if [ "$test"=="root" ]
then
echo "current user is root"
fi
test=$(env|grep "USER"|cut -d "=" -f 2)
if [ "$test"=="root" ]
then
echo "current user is root"
fi
2015-08-17
我的shell是zsh不是bash,貌似不能識(shí)別雙等號(hào),只能識(shí)別單個(gè)等號(hào)
2015-08-10
EQual
Not Equal
Greater Than
Less Than
Greater Equal
Less Equal
Not Equal
Greater Than
Less Than
Greater Equal
Less Equal
2015-08-10