diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/previous-work/more_control_helpers/lib/chgrp	Tue Jan 08 11:45:01 2013 +0000
     1.3 @@ -0,0 +1,27 @@
     1.4 +#!/bin/bash
     1.5 +# Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>
     1.6 +# You may do everything with this code except misrepresent its origin.
     1.7 +# PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
     1.8 +
     1.9 +DAISY_CHAIN=""
    1.10 +
    1.11 +for p in $(type -ap chgrp) ; do
    1.12 +  if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p ; break ; fi
    1.13 +done
    1.14 +
    1.15 +if [ ! -n "$DAISY_CHAIN" ]; then
    1.16 +  echo Cannot find real ${0##*/} command 
    1.17 +  exit 1
    1.18 +fi
    1.19 +
    1.20 +if [ $UID == 0 ]; then
    1.21 +  exec $DAISY_CHAIN "$@"
    1.22 +fi
    1.23 +
    1.24 +if [ "$1" == "tty" ]; then
    1.25 +  echo 1>&2 '***' chgrp "$@"  
    1.26 +else
    1.27 +  $DAISY_CHAIN "$@" || exit $?
    1.28 +fi
    1.29 +
    1.30 +exit 0