Skip to contentSkip to conversation

dash -n and -v not implemented?

DISCUSSION Adam Kellas 2 participants 2 messages Aug 23, 2010

lore
Share & tools
lore
#0 lore raw

Am I missing something, or do the -n and -v flags have no effect? The following compares the behavior of bash, ksh, and dash (bash requires an extra flag to suppress startup files):

% ksh -v -n -c uname
uname

% bash --norc -v -n uname
uname

% dash -v -n -c uname
Linux

AK

#1 lore raw
Quoted 4 lines · Adam Kellas

Am I missing something, or do the -n and -v flags have no effect? The following compares the behavior of bash, ksh, and dash (bash requires an extra flag to suppress startup files):

Quoted 8 lines

% ksh -v -n -c uname
uname

% bash --norc -v -n uname
uname

% dash -v -n -c uname
Linux

POSIX states that an interactive shell may ignore 'set -n'; and by extension, 'sh -n' can be a no-op if the shell would otherwise be interactive. But your example is not an interactive shell; and POSIX is clear that both -v and -n must have the same effect as an option to the shell command line as they would have to a use of set within the shell.

I think the absence of handling for both of these options is a definite bug according to POSIX rules on sh.

Signature · 2 lines
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org