Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The user will ls their home directory, see this file, and attempt to rm it. The shell will instruct rm to remove their home directory instead.


Ah. I feel a bit stupid for taking that so literally.

So, when i delete a directory, whenever possible, i use the rmdir command. rmdir refuses to delete a directory which isn't empty. It's a really handy safety check. If a colleague dropped a tilde directory on me, the process would go:

Well, i'll just delete that.

  $ rmdir ~
  rmdir: /home/twic: Directory not empty
Oh bugger, of course. Better quote it.'

  $ rmdir '~'
Right, now i will proceed to give my colleague a Chinese burn.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: