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

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

 



On Fri, 2022-03-11 at 10:12 +0000, Harald van Dijk wrote:
> This has -s and -c options. Contrary to your analysis below, as has
> been 
> answered on your Austin Group bug report, this has unspecified 
> behaviour. dash can do whatever it wants here.

Well with respect to that, I'd have also been fine if the standard
clearly says that this is unspecified.


> This only has a -c option. -s appears after 'echo foo', which is a 
> non-option, and is therefore also a non-option.

Stupid me, so obvious... *facepalm*


> The syntax to have both -s and -c options, but have -s appear after -
> c, is
> 
>    dash -c -s 'echo foo' script
> 
> which behaves the same as the -s -c case.

But still (even if POSIX leaves that open)... is this intended
behaviour by dash, that one can use -s and -c and it does actually
both?

It's not directly mentioned in the manpage (i.e. that both can be used
at the same time, and in which order these would then happen).
And the SYNOPSIS in the manpage would also rather imply that it's not
intended:
> SYNOPSIS
>     dash [-aCefnuvxIimqVEbp] [+aCefnuvxIimqVEbp] [-o option_name] [+o option_name] [command_file [argument ...]]
>     dash -c [-aCefnuvxIimqVEbp] [+aCefnuvxIimqVEbp] [-o option_name] [+o option_name] command_string [command_name [argument ...]]
>     dash -s [-aCefnuvxIimqVEbp] [+aCefnuvxIimqVEbp] [-o option_name] [+o option_name] [argument ...]

So I thought maybe it's just working by accident.


Cheers,
Chris.



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

  Powered by Linux