comparison previous-work/more_control_helpers/lib/chgrp @ 1:d6bef198ae71

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