fixline1   [plain text]


#!expect --
# Synopsis: fixline1 newpath < input > output
# Author: Don Libes

# Description: change first line of script to reflect new binary
# try to match any of the following first lines
#!expect ...
#!../expect ...
#!expectk ...
#!foo/bar/expectk ...
#
regsub "^#!(.*/)*(.*)" [gets stdin] "#!$argv/\\2" line1
puts -nonewline "$line1\n[read stdin]"