听着老师讲课,微信响了,回复消息时候老板来了,走路轻的跟猫一样,把我逮了个正着,啊。。。。。我勤奋上进的好员工形象全木有了哇哇哇哇哇~~~
2018-03-08
应该是根据执行者判断
$ ls -l
-rw-r--r-- 1 baozi staff 130 2 19 16:40 some_passwd
$ [ -x some_passwd ] && echo "yes" || echo "no"
no
#给group、other添加x权限,user没有x权限
$ chmod g+x,o+x some_passwd
$ ls -l
-rw-r-xr-x 1 baozi staff 130 2 19 16:40 some_passwd
$ [ -x some_passwd ] && echo "yes" || echo "no"
no
$ ls -l
-rw-r--r-- 1 baozi staff 130 2 19 16:40 some_passwd
$ [ -x some_passwd ] && echo "yes" || echo "no"
no
#给group、other添加x权限,user没有x权限
$ chmod g+x,o+x some_passwd
$ ls -l
-rw-r-xr-x 1 baozi staff 130 2 19 16:40 some_passwd
$ [ -x some_passwd ] && echo "yes" || echo "no"
no
2018-02-19
注意中括号左右要加空格:
$ [-e some_passwd] && echo "yes" || echo "no"
-bash: [-e: command not found
no
$ [ -e some_passwd] && echo "yes" || echo "no"
-bash: [: missing `]'
no
$ [ -e some_passwd ] && echo "yes" || echo "no"
yes
$ [-e some_passwd] && echo "yes" || echo "no"
-bash: [-e: command not found
no
$ [ -e some_passwd] && echo "yes" || echo "no"
-bash: [: missing `]'
no
$ [ -e some_passwd ] && echo "yes" || echo "no"
yes
2018-02-19
test='^[0-9]+$'
if ! [[ $YOURNUM =~ $test ]] ; then
echo "no"
else
echo "yes"
fi
if ! [[ $YOURNUM =~ $test ]] ; then
echo "no"
else
echo "yes"
fi
2018-02-10