in my bash script, I have some very danger lines like :rm -r *if it is mis-run in some folder, it would be very disastrous.Basically, I would need to add an if condition to make this does not trigger unless I am a folder call blah_pew_blah, in that case the damage done is probably minimal... But how do I check it? Thank you.
Ensure I am a in specific folder before calling rm
bash;directory;rm;safety
Assuming a modern bash, you can get the name of the current directory by runningbasename $(pwd)This can be used in a conditional, such asif test $(basename $(pwd)) != 'blah_pew_blah'; then    printf 'Not in expected directory, aborting!\n'    exit 0fi