Mercurial > pkg
view previous-work/more_control_helpers/lib/chmod @ 28:dd480255bd82
completed basic draft of pkg-examine script.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 10 Jan 2013 16:28:18 +0000 |
parents | d6bef198ae71 |
children |
line wrap: on
line source
1 #!/bin/bash2 # Copyright (c) 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!6 DAISY_CHAIN=""8 for p in $(type -ap chmod) ; do9 if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p ; break ; fi10 done12 if [ ! -n "$DAISY_CHAIN" ]; then13 echo Cannot find real ${0##*/} command14 exit 115 fi17 if [ $UID == 0 ]; then18 exec $DAISY_CHAIN "$@"19 fi21 report=022 doit=123 reportmsg="*** chmod $@"25 set -- "$@" eND_ofLisT26 while true ; do27 arg="$1"28 shift 129 case "_$arg" in30 _eND_ofLisT) break ;;31 _g+s|_u+s) report=1; doit=0 ;;32 _4755) arg=755 ; report=1; doit=1 ;;33 _4555) arg=555 ; report=1; doit=1 ;;34 *) ;;35 esac36 set -- "$@" "$arg"37 done39 if [ "$report" = 1 ]; then echo 1>&2 "$reportmsg" ; fi41 if [ "$doit" = 1 ]; then42 exec $DAISY_CHAIN "$@"43 fi45 exit 0