Fun With #! Lines
Jim Crammond
jim at hwcs.UUCP
Sun Aug 19 18:12:23 AEST 1984
I have a file called 'todo' which begins with the line
#!/usr/ucb/vi +2vi
Thus if I execute it, it vi's itself. The +2 is so it starts on the second line,
the 'vi' forces it into visual mode as it goes into open mode otherwise,
(a feature I presume).
Perhaps more useful is the way I've heard it is used in MU-Prolog:
When the MU-Prolog interpreter saves the program currently in memory
it dumps various structures into a file preceded by a
#!/usr/..../muprolog
Thus the saved file can be executed directly, it automatically calls up the
interpreter to read itself in and execute.
-Jim Crammond. ..!ukc!edcaad!hwcs!jim
More information about the Comp.unix.wizards
mailing list