Re: When running from a script execlineb does not use separated args

2018-07-31 Thread Laurent Bercot

#!/bin/execlineb -W -S 1

You're running into an unfortunate side effect of shebang lines where
only the first argument is available.


 Exactly. Shebang parsing is done by the kernel, which does not have
a complete command line parser. (If it had, the execlineb program
would be redundant: we could simply put whole argvs into the
shebang line and the kernel would launch the whole command as
execlineb does.)

 The kernel's shebang parser only understands a single argument after
the interpreter's name. To pass further options to the interpreter,
you need to squash the options into a single word. So here, what you
want can be achieved via

#!/bin/execlineb -WS1

--
 Laurent



Re: When running from a script execlineb does not use separated args

2018-07-30 Thread Colin Booth
On Mon, Jul 30, 2018 at 10:44:36PM -0500, Joshua Haase wrote:
> Using a script fails when using with the headers:
> 
> #!/bin/execlineb -W -S1
> 
> or
> 
> #!/bin/execlineb -W -S 1
> 
> I guess it's because when the commands are executed, the second part is
> treated as a single arg, so execlineb receives
> 
> execlineb '-W -S1' and thus fails to interpret that as options.
> 
You're running into an unfortunate side effect of shebang lines where
only the first argument is available.
> 
> $ execlineb '-W -S1' 'echo ${@}'
> execlineb: usage: execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | 
> -W ] [ -c commandline ] script args
> $ execlineb '-W -S1' 'echo ${@}' pato
> execlineb: usage: execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | 
> -W ] [ -c commandline ] script args
> 
> Should something be done about that problem?
> 
> Document that perk, maybe?
Unfortumately this is impossible to fix short of redoing the shebang
interpretation in Unix. You should be able to see similar behavior in
shell scripts by setting #!/bin/sh -e -x as your shebang (or something
similar).

-- 
Colin Booth


When running from a script execlineb does not use separated args

2018-07-30 Thread Joshua Haase
Using a script fails when using with the headers:

#!/bin/execlineb -W -S1

or

#!/bin/execlineb -W -S 1

I guess it's because when the commands are executed, the second part is
treated as a single arg, so execlineb receives

execlineb '-W -S1' and thus fails to interpret that as options.


$ execlineb '-W -S1' 'echo ${@}'
execlineb: usage: execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | -W 
] [ -c commandline ] script args
$ execlineb '-W -S1' 'echo ${@}' pato
execlineb: usage: execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | -W 
] [ -c commandline ] script args

Should something be done about that problem?

Document that perk, maybe?