3 ms·
I do this sort of thing a lot, not as a formalized utility but as a practice. For example I'll often do something like this: mv data ~/tmp/ cd ~/tmp/ rm
by fexl 15y ago
I do this sort of thing a lot, not as a formalized utility but as a practice. For example I'll often do something like this:
mv data ~/tmp/
cd ~/tmp/
rm -rf data
At least when I'm in the tmp directory I can see that clearly on the command line so I'm more comfortable issuing dangerous commands.
I suppose there might be room for a formal utility, but sometimes you just have to be careful. Take for example my "build" script for Fexl (at https://github.com/chkoreff/Fexl/blob/master/src/build https://github.com/chkoreff/Fexl/blob/master/src/build). There you will see these lines:
# I don't use $obj and $bin here because that would be dangerous if I made
# a mistake setting them above.
rm -rf ../obj
rm -rf ../bin
If I were not being so careful, I could simply say:
rm -rf $obj
rm -rf $bin
Because after, all, the $obj and $bin variables are "guaranteed" to point to safely disposable directories. Heh. Famous last words. Redundancy is key to reliability.