home | list info | list archive | date index | thread index

Fwd: [OCLUG-Tech] bash question

---------- Forwarded message ----------
From: Jeongyun Lee <jeongyun [ at ] gmail [ dot ] com>
Date: Jul 18, 2005 2:54 PM
Subject: Re: [OCLUG-Tech] bash question
To: Alexandre de Abreu <alexandre [ dot ] abreu [ at ] gmail [ dot ] com>


Interesting..

With the following script:

#!/bin/bash

X=y

echo 'X='$X
echo 'Y='$Y #returns empty/undeclared

(( $X=0 ))

echo 'X='$X
echo 'Y='$Y #returns 0!

exit 0

I got this result:
X=y
Y=
X=y
Y=


While with X=Y (uppoercase Y):
#!/bin/bash

X=Y

echo 'X='$X
echo 'Y='$Y #returns empty/undeclared

(( $X=0 ))

echo 'X='$X
echo 'Y='$Y #returns 0!

exit 0

I got this:
X=Y
Y=
X=Y
Y=0


On 7/18/05, Alexandre de Abreu <alexandre [ dot ] abreu [ at ] gmail [ dot ] com> wrote:
> Hi Jeremy,
>
> Interesting subject. I think you can do it with eval(), the following
> script will print "Linux":
>
> #!/bin/bash
>
> BOO="var_name"
> eval "$BOO=Linux"
> echo $var_name
>
> exit 0
>
> Cheers
>
> --
> Alexandre de Abreu
> GCUX, RHCE, LPIC-2
> _______________________________________________
> Linux mailing list
> Linux [ at ] lists [ dot ] oclug [ dot ] on [ dot ] ca
> http://www.oclug.on.ca/mailman/listinfo/linux
>

replies

references

message navigation