在Linux中,在中/proc/PID/fd/X,管道或套接字的文件描述符的链接具有数字,例如: l-wx------ 1 user user 64 Mar 24 00:05 1 -> pipe:[6839] l-wx------ 1 user user 64 Mar 24 00:05 2 -> pipe:[6839] lrwx------ 1 user user 64 Mar 24 00:05 3 -> socket:[3142925] lrwx------ 1 user user 64 Mar 24 00:05 4 -> socket:[3142926] lr-x------ 1 user user 64 …
在设置sudo环境时,我注意到include指令的前缀是井号(#)。 Solaris显示为: ## Read drop-in files from /etc/sudoers.d ## (the '#' here does not indicate a comment) #includedir /etc/sudoers.d 该手册(Linux和Solaris)指出: 从sudoers中包含其他文件可以使用#include和#includedir指令从当前正在解析的sudoers文件中包含其他sudoers文件。 和: 其他特殊字符和保留字井号(`#)用于表示注释(除非它是#include指令的一部分,或者除非它出现在用户名的上下文中并且后跟一个或多个数字,在这种情况下,它被视为uid)。注释字符及其后的任何文本,直到行尾都将被忽略。 有人知道为什么在#includeand #includedir指令中选择使用井号吗? 附带说明:我经常使用类似的方法egrep -v '^#|^$' configfile来获取非默认/活动的配置设置,这显然不适用于该sudoers文件。
为什么以下脚本无法执行,但语法错误为else: LOGS3_DIR=~/logs if [ -d "$LOGS3_DIR" ]; then cd cd "$LOGS3_DIR" echo "$LOGS3_DIR" for filename in `find "." -mtime 1 -type f` do if lsof "$filename" > /dev/null then # file is open else echo "deleting $filename" rm "$filename" fi done fi