#!/bin/sh # $Id: fixpaths,v 1.2 2022/10/20 00:33:09 tom Exp $ # # Run this script to update the paths in scripts under the current directory # which have perl's pathname, so they can be run in your configuration. # save_IFS="$IFS" IFS=':' PERL=perl for p in $PATH do if [ -f "$p/perl" ] then PERL="$p/perl" break fi done IFS="$save_IFS" TEXT="#!$PERL -w" find . -type f -print | while read name do case $name in *~) ;; *) head=`head -1 "$name"` case $head in #(vi \#!*perl*) #(vi echo "process $name" if test "$TEXT" != "$head" ; then echo "...updating " rm -f "${name}"~ mv "${name}" "${name}"~ sed -e "s@$head@$TEXT@" "${name}"~ >"${name}" chmod +x "${name}" else echo "...unchanged" fi ;; *) # echo ignored $name ;; esac ;; esac done