Archive for the 'Script' Category

How to keep files safe from accidental overwriting?

This happens many times. You accidentally use redirecting output using > operator.or example you type a command:
ls -l *.c > output.txt
If file output.txt exists and is a regular file it will be overwritten. Just imagine as root user, typing somecommand > /etc/passwd instead of somecommand < /etc/passwd. Or you used > when they meant [...]