Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Aug 2008 12:47:01 +0200
From:      Matias Surdi <matiassurdi@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: [OT] Evaluate strings in bash
Message-ID:  <g8jgul$j83$1@ger.gmane.org>
In-Reply-To: <200808211039.m7LAdnhk092337@lurza.secnetix.de>
References:  <g8i237$fqb$2@ger.gmane.org> <200808211039.m7LAdnhk092337@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Oliver Fromme escribió:
> Matias Surdi wrote:
>  > Oliver Fromme escribió:
>  > > Matias Surdi wrote:
>  > > > Oliver Fromme escribió:
>  > > > > Matias Surdi wrote:
>  > > > > > # echo $BINMAKE
>  > > > > > `if [ -x /usr/obj/usr/src/make.i386/make ]; then echo 
>  > > > > > /usr/obj/usr/src/make.i386/make; else echo make; fi` -m /usr/src/share/mk
>  > > > > > 
>  > > > > > I'd like to have a second variable like:
>  > > > > > [code]
>  > > > > > # echo $newvariable
>  > > > > > make -m /usr/src/share/mk
>  > > > > 
>  > > > > # newvariable=`eval echo $BINMAKE`
>  > > > 
>  > > > I've already tried that, but doesn't work.
>  > > 
>  > > It does work.  Maybe you forgot the "echo" part?
>  > 
>  > Maybe I've not explained it very well, look here: 
>  > http://www.linuxquestions.org/questions/linux-general-1/bash-strings-evaluation-664094/
> 
> You have explained it well enough, I think, and the
> solution I explained above works fine.  If it doesn't
> work for you, then you did it wrong.  The solution
> written at the URL you mentioned is unnecessarily
> complicated.
> 
> $ echo $BINMAKE
> `if [ -x /usr/obj/usr/src/make.i386/make ]; then echo /usr/obj/usr/src/make.i386/make; else echo make; fi` -m /usr/src/share/mk
> $ newvariable=`eval echo $BINMAKE`
> $ echo $newvariable
> make -m /usr/src/share/mk
> $ 
> 
> Best regards
>    Oliver
> 
You are right, this works fine also.I've forgot the "echo".

Thanks for your help.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?g8jgul$j83$1>