December 1999
Beginner
528 pages
11h 10m
English
Here’s an example of what we have just discussed. Here is a file called cleanup.
$ pg cleanup
#!/bin/sh
# name: cleanup
# this is a general cleanup script
echo "starting cleanup...wait"
rm /usr/lcoal/apps/log/*.log
tail -40 /var/adm/mesages >/tmp/messages
rm /var/adm/messages
mv /tmp/messages /var/adm/messages
echo "finished cleanup" The above script cleans up var/adm/ messages by truncating the file, and deletes all log files in /usr/local/apps/log.
To make the script executable we use the chmod command:
$ chmod u+x cleanup.
Now to run the script, just type the script name
$ cleanup
If you get an error back like this:
$ cleanup
sh: cleanup: command not found
try this:
$./cleanup
If you have to type a pathname ...
Read now
Unlock full access