Hallo Cruz.
Und jetzt sollen der owner und die group alle Dateien und Verzeichnisse beschreiben dürfen, also muss ich allen Dateien 664 und allen Verzeichnissen 775 geben. Wie kriege ich das mit nur 2 Kommandos hin?
Es geht sogar mit einem. Folgendes Script habe ich irgendwann einmal irgendwo gefunden und seitdem residiert es bei mir unter /usr/bin/rchmod:
#!/bin/sh
# recursive chmod with arguments for files and directories
# save internal field separator
IFS_save=$IFS
# set internal field separator, thx to matthias
IFS=$'
'
# read arguments
chmodf=$1 # chmod for files
chmodd=$2 # chmod for directories
dir=$3 # start directory
# test for arguments $1 and $2
if [ -z "$chmodf" -o -z "$chmodd" ]
then
echo "Usage: `basename $0` fff ddd [pfad]"
echo " fff ... chmod argument for files (644)"
echo " ddd ... chmod argument for direcories (755)"
echo " pfad ... nothing for current directory"
exit
fi
# if no start directory, use current directory
if [ -z "$dir" ]
then
dir="."
fi
#"\$x='$x'"
# find backwards all files and directories
for file in `find "$dir" -name "*"`
do
# debug print
#echo "$file"
if [ -d $file ] # directory
then
# chmod
chmod $chmodd $file
elif [ -e $file ] # file
then
# chmod
chmod $chmodf $file
else
echo "error: $file"
fi
done
#set back internal field separator
IFS=$IFS_sav
Es hat mir bisher schon viel Arbeit abgenommen.
Einen schönen Dienstag noch.
Gruß, Mathias
--
sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
debian/rules
sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
debian/rules