Sunday, July 11, 2010

A Unix joke

Unix (well, Linux) is great. If it isn't obscure or obfuscated, it's just plain tricky.

I was just making a new user (for a system process) and I wanted to set some environment variables, so I did:

cp -a /etc/skel/.* .

...and I ended up with a copy of /etc! I was confounded, until a very observant colleague pointed out that ".*" will also match ".."!

From now on, I'm going to be doing a "ls -l" with my path names before I do a "rm -rf"!! Also, never do "rm -rf .*" to remove all hidden files.