06/07/2011
Restoring the executable bit
I got a bunch of files on Mac OS X who lost their executable bit (because they got copied to and from a Windows host), I wanted to automatically restore them all. Being such a newbie with bash it took me some time but I managed to get this one running, and I am so proud I feel like sharing it with the world. That’s supposed to be just one line.
for f in *; do if [[ `file $f` == *executable* ]]; then chmod a+x $f; fi done;
Am I doing this right?