LDP/LDP/guide/docbook/abs-guide/ex12.sh

16 lines
405 B
Bash
Raw Permalink Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
filename=sys.log
cat /dev/null > $filename; echo "Creating / cleaning out file."
2012-04-04 22:51:18 +00:00
# Creates the file if it does not already exist,
2002-04-01 16:04:17 +00:00
#+ and truncates it to zero length if it does.
2002-06-03 14:35:48 +00:00
# : > filename and > filename also work.
2001-07-10 14:25:50 +00:00
tail /var/log/messages > $filename
# /var/log/messages must have world read permission for this to work.
echo "$filename contains tail end of system log."
exit 0