[TAG] [TIPS] make script command logs without escape character
ben at linuxgazette.net
Tue May 27 16:39:05 MSD 2008
On Tue, May 27, 2008 at 08:12:10AM +0100, Thomas Adam wrote:
> script -f foo
> $ blah
> $ ls
> $ sudo rm -fr / # :P
Heh. Here's a cute-but-stupid (in a "watch me cut my leg off with a
chainsaw - WHOOPS!" way) trick:
ben at Tyr:/tmp/foo$ >-rf # Create a file called '-rf'
ben at Tyr:/tmp/foo$ mkdir xyz # Create a directory called 'xyz'
ben at Tyr:/tmp/foo$ >xyz/foobar # Create a file called 'foobar' in 'xyz/'
ben at Tyr:/tmp/foo$ ls -1F
ben at Tyr:/tmp/foo$ rm *
ben at Tyr:/tmp/foo$ ls
Note that 'xyz', even though it was non-empty, is gone - and '-rf' is
UNIX was never designed to keep people from doing stupid things, because
that policy would also keep them from doing clever things.
-- Doug Gwyn
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *
More information about the TAG