For example I have a script looks like:
for i in */*/
do
cd $i
cp POSCAR.ideal OSZICAR ..
cd ..
rm -r */
cd ../;
done
to remove subfolder of a folder, however with a bit of uncautious, for example, the last ../
is miswritten as ../../
, then the whole computer will be erased. Which is extremely bad! So I want to ask is there a method to safely confine the operation range of a terminal so that such tragedy does not appear?
man find
; avoid insecurecd
in loops -- try to use full paths; use "echo rm ..." before " rm"; use "rm -i" to confirm; don' t root accounts on Fridays...