I'm learning how to make script "fool-proof". I have some scripts that modify files in the current folder but they also modify the script itself. I know it all boils down to the "for" loop with "find" I can't get right.
for f in $(find . -type f | grep -v $0)
My goal is to include all files it can find from the current catalogue and it's sub-catalogues but exclude the executed script itself. It's working with grep -v but now it's excluding every file that includes the name of the script (like copies of the script in the subfolders). Anyone knows how to make it work only for the executed script? I must assume someone might change the name at some point, so excluding it by hand is out of the question.