-g FILE (conditional operator)
true if the file exists and its set-group-id bit is set, i.e. the SETGID bit.
false if the file does not exist or does not have the SETGID bit set.
-u is for the set-user-id bit.
Links
Examples
- Different ways to test if a file has the SETGID bit set:
- 1 2 3 4- test -g ~/bin/cmd && echo "SETGID set" [ -g ~/bin/cmd ] && echo "SETGID set" # Bash [[ -g ~/bin/cmd ]] && echo "SETGID set"
- Set the SETGIDbit
- 1- chmod g+s /usr/local/bin/my-cmd
BashSupport Pro is a Bash IDE with support for -g – try it now!