12 2013 档案

摘要:错误的方式:# su - testuser -c "/tmp/test.sh; echo $?"Sun Microsystems Inc. SunOS 5.10 Generic January 20050正确的方式:# su - testuser -c '/tmp/test.sh; echo $?'Sun Microsystems Inc. SunOS 5.10 Generic January 20053区别就在于单引号和双引号的含义不同,双引号会进行内容解析,单引号是原样传入。可以用set -x查看:# set -x# su - testuser -c & 阅读全文
posted @ 2013-12-25 13:53 鸪斑兔 阅读(1339) 评论(1) 推荐(0) 编辑
摘要:id | sed -e 's/).*//g' -e 's/.*(//'比$LOGNAME $NAME who am i都要准确一些 阅读全文
posted @ 2013-12-25 11:47 鸪斑兔 阅读(323) 评论(0) 推荐(0) 编辑