March 2005
Intermediate to advanced
696 pages
14h 25m
English
This appendix contains samples of all the scripts used in the previous chapters.
The first argument of the script is the target directory and must have a trailing /. The script prints an on-screen list of all the files it has modified.
[root@bigboy tmp]# ./fix-www-perms.sh /home/www/webpages/
/home/www/webpages/
/home/www/webpages/file1.htm
/home/www/webpages/file2.htm
...
...
...
[root@bigboy tmp]
Here’s how it’s done:
#!/bin/sh # # fix-www-perms.sh - Recursively fixes file permissions in a www directory # so that Apache may serve the pages correctly # # (c) SiliconValleyCCIE.com # for i in `find $1` do if [ -d $i ] ; then chmod 755 $i echo $i else chmod 644 $i echo ...
Read now
Unlock full access