bug-bash
[Top][All Lists]
Advanced

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

Re: enviroment variable lost value


From: Pierre Gaston
Subject: Re: enviroment variable lost value
Date: Thu, 11 Jun 2009 13:46:08 +0300

On Wed, Jun 10, 2009 at 12:44 PM, Xiaoqiang Zheng<address@hidden> wrote:
>
> From: root
> To: address@hidden
> Subject: [50 character or so descriptive subject here (for reference)]
>
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: i686-pc-linux-gnu-gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
> -DCONF_OSTYPE='linu
> x-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' 
> -DLOCALEDIR='/usr/
> share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I
> ./lib 
> -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
> sbin:/bin' -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' 
> -DSYS_BASHRC='/
> etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' 
> -DNON_INTERACTIVE_LOG
> IN_SHELLS -DSSH_SOURCE_BASHRC -O2 -march=i686 -pipe
> uname output: Linux gentoo 2.6.29-gentoo-r5 #4 SMP Wed Jun 3 16:10:00 CST 
> 2009 i
> 686 Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz GenuineIntel GNU/Linux
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 4.0
> Patch Level: 24
> Release Status: release
>
> Description:
> bash not work as expected
>
> Repeat-By:
>
> # bash <<EOF
>> i=LAN
>> env|grep $i
>> EOF
> Usage: grep [OPTION]... PATTERN [FILE]...
> Try `grep --help' for more information.
> # bash<<EOF
>> env|grep LAN
>> EOF
> LANG=en_US.UTF-8
> # bash<<EOF
>> i=bin
>> /$i/hostname
>> EOF
> bash: line 2: //hostname: No such file or directory
> # bash<<EOF
>> i=bin /$i/hostname
>> EOF
> bash: line 1: //hostname: No such file or directory
> # bash
> # i=bin
> # /$i/hostname
> l5u3.domain.com
> # exit
> #

bash works as expected, if EOF is not quoted the variables are
expanded before your command runs:

$ i=foo
$ bash <<EOF
> i=bar
> echo $i
> EOF
foo
$ bash << 'EOF'
> i=bar
> echo $i
> EOF
bar




reply via email to

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