#!/bin/sh # # rightperl - change the pathname to perl, in the first line of Perl scripts # # $Id$ perl=`which perl` [ -x $perl ] || { echo $0: cannot find perl 1>&2; exit 1; } scriptfound= for f in "$@" do if perl -lpe 'exit !m:^#!.*perl(\s|$):' "$f" then $perl -0pi.rightperl -e 's:^#!.*perl(\s|$):#!'$perl'$1:' "$f" scriptfound=1 fi done if [ X = X"$scriptfound" ] then echo $0: none of the arguments is a perl script 1>&2; exit 2 fi exit 0