| 1 | #!/bin/bash |
| 2 | |
| 3 | filename=sys.log |
| 4 | |
| 5 | cat /dev/null > $filename; echo "Creating / cleaning out file." |
| 6 | # Creates the file if it does not already exist, |
| 7 | #+ and truncates it to zero length if it does. |
| 8 | # : > filename and > filename also work. |
| 9 | |
| 10 | tail /var/log/messages > $filename |
| 11 | # /var/log/messages must have world read permission for this to work. |
| 12 | |
| 13 | echo "$filename contains tail end of system log." |
| 14 | |
| 15 | exit 0 |