3 # Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>
4 # You may do everything with this code except misrepresent its origin.
5 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
7 # Copyright (C) 2014 Steve Youngs <steve@steveyoungs.com>
8 # Handle chgrp options and chgrp'ing outside the user's group list.
12 for p in $(type -ap chgrp) ; do
13 if [ ! $p -ef $0 ]; then
19 if [ ! -n "$DAISY_CHAIN" ]; then
20 echo 1>&2 '***' Cannot find real ${0##*/} command
24 if [ $(id -u) == 0 ]; then
25 echo 1>&2 '***' $(dirname $0) should not be in root\'s \$PATH
26 echo 1>&2 '***' call '"'$DAISY_CHAIN $@'"' directly
30 # Preserve the command line because we're about to mess with it.
33 # Remove any options so $1 becomes the group name.
41 # If you're not root you can only chgrp to groups you are in, so lets
45 printf '%d' "$1" &>/dev/null
51 for g in ${GRP_LIST}; do
52 if [ "$1" == "$g" ]; then
58 if [ -z "$GRP_CHAIN" ]; then
59 echo 1>&2 '***' chgrp ${cmdline}
61 exec $DAISY_CHAIN ${cmdline} || exit $?