bug-bash
[Top][All Lists]
Advanced

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

misleading error message from variable modifier


From: don fong
Subject: misleading error message from variable modifier
Date: Fri, 23 Feb 2018 19:20:39 -0800

hi folks.  i'm a bash user, who just noticed a slight anomaly.  it has
to with the shell variable modifier ${parameter?} .  according to the
man page, ${X?} should yield an error message and exit if X is unset,
otherwise the value of X.  in this case,

    unset X; echo ${X?}

i expect to get an error message, and indeed an error message results.

    bash: X: parameter null or not set

but i think the error message is misleading.  the wording sort of
implies that null would be an error, even though with the ? modifier,
null is OK.  it's kind of confusing as well, to see the same error
message from both ${X?} and ${X:?} when they are really checking
distinct things.

i think the error message should say

    bash: X: parameter is not set

a co-worker challenged me to submit a patch.  so i downloaded the
code, looked at it, made a fix, and created a test script compatible
with the existing tests/ framework.  all tests pass.  (i glanced
around in the tests/ directory, did not see any tests of the variable
modifiers, so i extended my tests to cover some of the other modifiers
as well.)

i would like to submit this change for inclusion in bash.  how should i proceed?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]