Removal of unfortunately named $HOME file
In the course of debugging a script it managed to touch a file which it named as "$HOME" in my cwd. EDIT: it turned out that it was ansible itself that was creating this directory. Obviously as this is a reserved name it caused no end of trouble in that I needed to be very careful in removing it.
In this case I can simply escape the dollar and remove it, but things are not always so easy:
[root@934eb43d0165 /]# echo rubbish > \$HOME [root@934eb43d0165 /]# rm -i \$HOME rm: remove regular file '$HOME'? n
Due to the difficulty of quoting this file and not having it expand to my actual homedir it is safer to just operate on the inode instead of the name.
the inode contains all the information about a file--indeed, it is not incorrect to say that the inode _is_ the file. -- from "info rm"
So, first of all ensure that this really is a different thing from my homedir and then remove it.
[root@934eb43d0165 /]# ls -il | grep HOME 137468 -rw-r--r--. 1 root root 8 Mar 2 20:03 $HOME
[root@934eb43d0165 /]# find -inum 137468 -exec rm '{}' \; [root@934eb43d0165 /]# ls -il | grep HOME











