bug-bash
[Top][All Lists]
Advanced

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

Re: variables set on command line


From: Sam Steingold
Subject: Re: variables set on command line
Date: Wed, 24 Aug 2011 12:07:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> * Eric Blake <address@hidden> [2011-08-24 09:31:45 -0600]:
>> f(){ echo a=$a b=$b c=$c ; }
>> f
>> a= b= c=
>> a=a b=b f
>> a=a b=b c=
>> f
>> a=a b=b c=
>
> Which is indeed correct under the rules for POSIX

This sucks big time.
So if I want to bind a variable for an eval invocation and do this:

  eval "`./libtool --tag=CC --config | grep '^archive_cmds='`"
  CC='${CC}' libobjs='$libs' deplibs='${CLFLAGS}' compiler_flags='${CFLAGS}' \
    soname='$dll' lib='$lib' output_objdir='$dyndir' \
    eval XCC_CREATESHARED=\"${archive_cmds}\"

and I want CC to have an old value after the second eval, I need to save
it and restore it by hand, like this:

  CC_save=$CC
  CC='${CC}' libobjs='$libs' deplibs='${CLFLAGS}' compiler_flags='${CFLAGS}' \
    soname='$dll' lib='$lib' output_objdir='$dyndir' \
    eval XCC_CREATESHARED=\"${archive_cmds}\"
  CC=$CC_save

however, this does not distinguish between unset CC and CC=''.
(is there a way to distinguish these two situations?)

thanks!

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 
11.0.60900031
http://ffii.org http://palestinefacts.org http://honestreporting.com
http://thereligionofpeace.com http://openvotingconsortium.org http://dhimmi.com
Abandon all hope, all ye who press Enter.




reply via email to

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