[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] Environment variables - with or without $?
From: |
valdis . kletnieks |
Subject: |
Re: [Nmh-workers] Environment variables - with or without $? |
Date: |
Thu, 23 Mar 2017 14:15:09 -0400 |
On Thu, 23 Mar 2017 17:59:07 -0000, Ralph Corderoy said:
> Hi Larry,
>
> No dollar. I have an environment variable called `$FOO'.
Which shows up that way in 'printenv', and requires the use of $$FOO to
dereference? (Some quick testing with bash 4.4 seems to indicate that
it *really* doesn't want to see $ as the first character of a variable
name. I had to use 'env' to jam it in there, and accessing it was.. problematic
[~] env '$FOO=27' printenv | grep FOO
$FOO=27
[~] env '$FOO=27' bash
[~]1 printenv | grep FOO
$FOO=27
[~]1 echo $FOO
[~]1 echo $$FOO
9305FOO
[~]1 echo $\$FOO
$$FOO
[~]1 eval echo \$$FOO
$
[~]1 eval echo \$\$FOO
9305FOO
[~]1 exit
pgptOEIE1YGXO.pgp
Description: PGP signature