聽著老師講課,微信響了,回復(fù)消息時候老板來了,走路輕的跟貓一樣,把我逮了個正著,啊。。。。。我勤奮上進(jìn)的好員工形象全木有了哇哇哇哇哇~~~
2018-03-08
應(yīng)該是根據(jù)執(zhí)行者判斷
$ 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權(quán)限,user沒有x權(quán)限
$ 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權(quán)限,user沒有x權(quán)限
$ 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