#!expect -f # Synopsis: expect fixline1 newpath < input > output # Author: Don Libes # Description: change first line of script to reflect new binary set newpath [lindex $argv 1] gets stdin buf # try to match any of the following match #!expect ... #!../expect ... #!expectk ... #!foobar/expectk ... if 1==[regexp "^#!(.*/)*(.*)" $buf dummy1 dummy2 tail] { puts stdout "#!$newpath/$tail" # puts stdout "#!$new/ [lrange [split $buf " "] 1 end]" } else { puts stdout $buf } while {-1!=[gets stdin buf]} { puts stdout $buf }