calling python interpreter

Michael Hudson mwh21 at cam.ac.uk
Wed Sep 1 12:14:47 EDT 1999


On Wed, 1 Sep 1999, Adrian Eyre wrote:

> > I found a solution: chmod ugo+rx pippo.py. But ... should I do the
> > same for every script? Does exist a faster system?
> 
> #!/bin/sh
> for script in `find . -name '*.py'`; do
>  chmod 755 $script
> done

I'm waiting for a build, so I don't have anything better to do than

#!/bin/bash
for script in $(find -name '*.py'); do
    firstline=$(head -n 1 $script)
    { echo $firstline | egrep "^#!" > /dev/null; }  || continue
    executable=$(echo $firstline | cut -b3- | awk '{ print $1 }')
    [ -x $executable ] || continue
    echo chmod 755 $script
done

except go home. Rewrites in Python will be ceremoniously ignored.

bashful-ly y'rs - Michael





More information about the Python-list mailing list