bug-bash
[Top][All Lists]
Advanced

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

[bug #65981] "bash test -v" does not work as documented with "export KEY


From: anonymous
Subject: [bug #65981] "bash test -v" does not work as documented with "export KEY="
Date: Fri, 12 Jul 2024 22:15:02 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?65981>

                 Summary: "bash test -v" does not work as documented with
"export KEY="
                   Group: The GNU Bourne-Again SHell
               Submitter: None
               Submitted: Sat 13 Jul 2024 02:15:01 AM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 13 Jul 2024 02:15:01 AM UTC By: Anonymous
The documentation of the
[https://www.gnu.org/software/bash/manual/bash.html#Bash-Conditional-Expressions
Bash-Conditional-Expressions] "-v varname" says:

> -v varname
>    True if the shell variable varname is set (has been assigned a value).

I think "export TEST_EQUAL_WITHOUT_VALUE=" does not assign a value to the
varname, does it?

Test case:
> docker run -it --rm bash:latest
> export TEST_EQUAL_WITHOUT_VALUE=
> if test -v TEST_EQUAL_WITHOUT_VALUE; then echo "true"; else echo "false";
fi

The output is "true", but there is no value assigned to it.

That is fine to me. I suggest to change the documentation and remove the "(has
been assigned a value)" part.


Tested with: GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-musl)







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65981>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

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