4 ms·
My teammate a couple years ago was writing a script that needed to clear a working directory, so `rm -rf $path/*`. He ran it during debugging and found one mist
by trickstra 6y ago
My teammate a couple years ago was writing a script that needed to clear a working directory, so `rm -rf $path/*`. He ran it during debugging and found one mistake - at some point the $path variable came in empty......
- kazinator 6y agoOh I did that in a distro build script where $path was called $INSTALL, but was empty (possibly due to a misspelling of the variable). Double stupidly, I ran it as root and so $INSTALL/lib blew off the system's libraries. I recovered the machine without any rescue disk or reboot or anything, by by copying files from an installation of the same distro. Of course, no commands for copying worked. I think what I might have done is to NFS mount that machine from the other machine, and then doing the copying on that machine.
- saagarjha 6y agoThis is why set -u goes at the top of all my scripts ;)