Re: What does @{FOOBAR@a} mean? (bash)

Liste des GroupesRevenir à cu shell 
Sujet : Re: What does @{FOOBAR@a} mean? (bash)
De : lew.pitcher (at) *nospam* digitalfreehold.ca (Lew Pitcher)
Groupes : comp.unix.shell
Date : 13. Apr 2024, 23:14:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uvf043$33fov$1@dont-email.me>
References : 1
User-Agent : Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
On Sat, 13 Apr 2024 20:35:27 +0000, Kenny McCormack wrote:

Observe:
 
$ unset FOOBAR
$ echo ${FOOBAR@a}
 
$ FOOBAR=
$ echo ${FOOBAR@a}
 
$ export FOOBAR
$ echo ${FOOBAR@a}
x
$
 
It seems that it prints "x" iff the variable has been exported.
This works with any variable - the output is always "x" (iff it is exported).
 
I can find no mention of this feature in "man bash".
[snip]
What is going on?

${parameter@operator}
              Parameter transformation.  The expansion is either a
              transformation of the value of parameter or information
              about parameter itself, depending on the value of
              operator.  Each operator is a single letter:

              U      The expansion is a string that is the value of
                     parameter with lowercase alphabetic characters
                     converted to uppercase.
              u      The expansion is a string that is the value of
                     parameter with the first character converted to
                     uppercase, if it is alphabetic.
              L      The expansion is a string that is the value of
                     parameter with uppercase alphabetic characters
                     converted to lowercase.
              Q      The expansion is a string that is the value of
                     parameter quoted in a format that can be reused as
                     input.
              E      The expansion is a string that is the value of
                     parameter with backslash escape sequences expanded
                     as with the $'...' quoting mechanism.
              P      The expansion is a string that is the result of
                     expanding the value of parameter as if it were a
                     prompt string (see PROMPTING below).
              A      The expansion is a string in the form of an
                     assignment statement or declare command that, if
                     evaluated, will recreate parameter with its
                     attributes and value.
              K      Produces a possibly-quoted version of the value of
                     parameter, except that it prints the values of
                     indexed and associative arrays as a sequence of
                     quoted key-value pairs (see Arrays above).
              a      The expansion is a string consisting of flag values
                     representing parameter's attributes.
              k      Like the K transformation, but expands the keys and
                     values of indexed and associative arrays to
                     separate words after word splitting.

I don't know when it was introduced into bash. My version of bash
 (GNU bash, version 4.3.48(1)-release (x86_64-slackware-linux-gnu) )
doesn't support it.

--
Lew Pitcher
"In Skills We Trust"

Date Sujet#  Auteur
13 Apr 24 * What does @{FOOBAR@a} mean? (bash)10Kenny McCormack
13 Apr 24 +- Re: What does @{FOOBAR@a} mean? (bash)1John-Paul Stewart
13 Apr 24 +* Re: What does @{FOOBAR@a} mean? (bash)2Helmut Waitzmann
13 Apr 24 i`- Re: What does @{FOOBAR@a} mean? (bash)1Kenny McCormack
14 Apr 24 `* Re: What does @{FOOBAR@a} mean? (bash)6Lew Pitcher
14 Apr 24  +* Re: What does @{FOOBAR@a} mean? (bash)3Kenny McCormack
14 Apr 24  i`* Re: What does @{FOOBAR@a} mean? (bash)2Kenny McCormack
14 Apr 24  i `- Re: What does @{FOOBAR@a} mean? (bash)1vallor
14 Apr 24  `* Re: What does @{FOOBAR@a} mean? (bash)2Popping Mad
14 Apr 24   `- Re: What does @{FOOBAR@a} mean? (bash)1Lew Pitcher

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal