-u FILE (conditional operator)
true if the file exists and its set-user-id bit is set, i.e. the SETUID bit.
false if FILE does not exist or does not have the SETUID bit set.
-g is for the set-group-id bit.
Links
Examples
- Different ways to test if a file has the SETUID bit set:
1 2 3 4test -u ~/bin/cmd && echo "SETUID set" [ -u ~/bin/cmd ] && echo "SETUID set" # Bash [[ -u ~/bin/cmd ]] && echo "SETUID set"- Set the
SETUIDbit: 1chmod u+s /usr/local/bin/my-cmd
BashSupport Pro 是一个 支持 -u 的 Bash 集成开发工具 – 马上试用!