3 ms·
My safety technique is to echo the commands before I do the actual commands as a sanity check, e.g. for i in $(find something); do echo "rm -f $i"; done (bash
by niobe 2y ago
My safety technique is to echo the commands before I do the actual commands as a sanity check, e.g.
for i in $(find something); do echo "rm -f $i"; done
(bash example as my TCL is rusty)
- dundarious 2y agoChange your do block to `printf %q\ rm -f "$i" ; echo` and it won't lie about spaces. In case HN has "trimmed" my post in some way, as it often does, that's: percent q backslash space space. Works in bash/zsh, but not dash, probably not whatever your sh is. Can make a function of it trivially, but you have to handle the $# -eq 0 case, return whatever printf returns, etc.