-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 4
test -u ~/bin/cmd && echo "SETUID set" [ -u ~/bin/cmd ] && echo "SETUID set" # Bash [[ -u ~/bin/cmd ]] && echo "SETUID set"
- Set the
SETUID
bit: 1
chmod u+s /usr/local/bin/my-cmd
BashSupport Pro is a Bash IDE with support for -u – try it now!