annotate previous-work/more_control_helpers/lib/chgrp @ 36:d66d34065dd9 tip

better less.
author Robert McIntyre <rlm@mit.edu>
date Sun, 19 May 2013 14:40:32 -0400
parents d6bef198ae71
children
rev   line source
rlm@1 1 #!/bin/bash
rlm@1 2 # Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>
rlm@1 3 # You may do everything with this code except misrepresent its origin.
rlm@1 4 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
rlm@1 5
rlm@1 6 DAISY_CHAIN=""
rlm@1 7
rlm@1 8 for p in $(type -ap chgrp) ; do
rlm@1 9 if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p ; break ; fi
rlm@1 10 done
rlm@1 11
rlm@1 12 if [ ! -n "$DAISY_CHAIN" ]; then
rlm@1 13 echo Cannot find real ${0##*/} command
rlm@1 14 exit 1
rlm@1 15 fi
rlm@1 16
rlm@1 17 if [ $UID == 0 ]; then
rlm@1 18 exec $DAISY_CHAIN "$@"
rlm@1 19 fi
rlm@1 20
rlm@1 21 if [ "$1" == "tty" ]; then
rlm@1 22 echo 1>&2 '***' chgrp "$@"
rlm@1 23 else
rlm@1 24 $DAISY_CHAIN "$@" || exit $?
rlm@1 25 fi
rlm@1 26
rlm@1 27 exit 0