#!/bin/sh # # envperl - use 'env' in the header of Perl scripts # # $Id$ # # this often increases portability - see also ./rightperl env=/usr/bin/env [ -x $env ] || { echo $0: cannot find $env 1>&2; exit 1; } files=`$env perl -w0ne \ 'm:^#!\s*\S*(env\s+perl|perl).*: and print "$ARGV "' "$@"` if [ X = X"$files" ] then echo $0: none of the arguments is a perl script 1>&2; exit 2 fi $env perl -w0pi.envperl -e \ 's:^#!\s*\S*(env\s+perl|perl).*:#!'$env' perl:' $files # do not leave options such as -w on: Linux chokes on them