possible wrong behaviour when -s and -c are both used

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

 



Hey.

I've noted that dash gives different behaviour when both -s and -c are
used, depending on their order:

calestyo@heisenberg:~$ cat script
date
calestyo@heisenberg:~$

calestyo@heisenberg:~$ dash -s -c 'echo foo' script
foo
$     <--- this is dash's prompt, and it reads input from stdin
calestyo@heisenberg:~$ dash -c 'echo foo' -s script
foo
calestyo@heisenberg:~$ 


POSIX specifies[0]:
> -c
>    Read commands from the command_string operand.
>    ...
>    No commands shall be read from the standard input.


So I'd say -c is ought to override -s ... but in any case I'd guess
it's unintended that the order of the two changes the behaviour?!


Thanks,
Chris.


[0] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux