Mercurial > pkg
view previous-work/more_control_helpers/lib/mkdir @ 29:819e950ac8cc
minor changes.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 10 Jan 2013 16:59:50 +0000 |
parents | d6bef198ae71 |
children |
line wrap: on
line source
1 #!/bin/bash2 # Copyright (c) 2000 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 watchdir=/usr/share/locale8 DAISY_CHAIN=""10 for p in $(type -ap mkdir) ; do11 if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p ; break ; fi12 done14 if [ ! -n "$DAISY_CHAIN" ]; then15 echo Cannot find real ${0##*/} command16 exit 117 fi19 if [ $UID == 0 ]; then20 exec $DAISY_CHAIN "$@"21 fi23 cmdline="$@"25 dirs=""26 for((i=$#; $i>0;))27 do28 a="$1"29 shift 1; i=$(($i-1))30 case "$a" in31 $watchdir/*) dirs="$dirs ""`expr $a : "$watchdir/\(.*\)"`"32 set -- "$@" "$a"33 ;;34 *) set -- "$@" "$a" ;;35 esac36 done38 $DAISY_CHAIN "$@" || exit $?40 test z"$dirs" != z &&41 echo 1>&2 '***' mkdir "$cmdline"42 for dir in $dirs ; do43 cumuldir=""44 for d in `echo $dirs | sed 's#/# #g' -` ; do45 cumuldir=$cumuldir$d/46 chgrp install $watchdir/$cumuldir47 test -k $watchdir/$cumuldir || chmod g+w,o+t $watchdir/$cumuldir48 done49 done50 exit 0