What does /dev/null mean in a shell script?
Posted
by
rishiag
on Ask Ubuntu
See other posts from Ask Ubuntu
or by rishiag
Published on 2014-08-22T17:18:25Z
Indexed on
2014/08/23
16:33 UTC
Read the original article
Hit count: 204
I've started learning bash scripting by using this guide: http://www.tldp.org/LDP/abs/abs-guide.pdf
However I got stuck at the first script:
cd /var/log
cat /dev/null > messages
cat /dev/null > wtmp
echo "Log files cleaned up."
What do lines 2 and 3 do in Ubuntu (I understand cat
)? Is it only for other Linux distributions? After running this script as root, the output I get is Log files cleaned up.
But /var/log
still contains all the files.
© Ask Ubuntu or respective owner