-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.

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 ist eine Bash IDE mit Unterstützung für -uprobieren Sie es aus!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches