[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: #! syntax



On Mon, 26 Feb 2001 21:49:29 +0300
Alexey Vyskubov <alexey@pepper.spb.ru> wrote:

This one should work (didn't try it):

	#!/bin/sh

	PERL=`which perl`
	tail +7 $0 | $PERL
	exit 0

	# start perl code
	...

..assuming that perl code starts on line 7.


> > The problem I found with env was that the shell incorrectly passes args to
> > env:
> 
> The shell DOES pass args correctly. RTFM (info bash):
> 
> "The arguments to the interpreter consist of a single optional
> argument following the interpreter name on the first line of the script
> file, followed by the name of the script file, followed by the rest of
> the arguments."
> 
> > 
> >     % head -1 t348.sh 
> >     #! /usr/bin/env perl -w
> >     % ./t348.sh 
> >     env: perl -w: No such file or directory
> > 
> > How does one get around this? Please don't say, "Don't use perl."
> 
> Just write some wrapper and use
> #!/your/wrapper
> 
> wrapper will be runned as 
> 
> wrapper 'name_of_your_script'


--
Christoph Simon
datageo@terra.com.br
---
^X^C
q
quit
:q
^C
end
x
exit
ZZ
^D
?
help
shit
.



Reply to: