Re: [OT] Evaluate strings in bash

2008-08-21 Thread Matias Surdi

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.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [OT] Evaluate strings in bash

2008-08-21 Thread Oliver Fromme
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

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"Python is an experiment in how much freedom programmers need.
Too much freedom and nobody can read another's code; too little
and expressiveness is endangered."
-- Guido van Rossum
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [OT] Evaluate strings in bash

2008-08-20 Thread Matias Surdi

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?

Best regards
   Oliver



Maybe I've not explained it very well, look here: 
http://www.linuxquestions.org/questions/linux-general-1/bash-strings-evaluation-664094/


Thanks for your help.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [OT] Evaluate strings in bash

2008-08-20 Thread Matias Surdi

Matias Surdi escribió:

Hi, sorry for the offtopic, but maybe somebody can help me here.

I've the following variable:

[code]
# 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

#
[/code]

It's a string wich includes a commmand.

How can I get the subcommand replaced by its output?

I'd like to have a second variable like:

[code]
# echo $newvariable
make -m /usr/src/share/mk
#
[code]


Thanks a lot.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
"[EMAIL PROTECTED]"





I've finally managed to do what I was trying to do, look here:

http://www.linuxquestions.org/questions/linux-general-1/bash-strings-evaluation-664094/


Thank you all for your help :-)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [OT] Evaluate strings in bash

2008-08-20 Thread Oliver Fromme
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?

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"To this day, many C programmers believe that 'strong typing'
just means pounding extra hard on the keyboard."
-- Peter van der Linden
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [OT] Evaluate strings in bash

2008-08-20 Thread Matias Surdi

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`

By the way, this has nothing to do with bash.  Those things
work with every bourne shell, including FreeBSD's /bin/sh.
It even works with Solaris' /bin/sh which is very far from
a POSIX shell.  :-)

Best regards
   Oliver



I've already tried that, but doesn't work.

$newvariable will end with the output of running "make -m 
/usr/src/share/mk" on the current directory and not with the string 
"make -m /usr/src/share/mk" which is wat I want.



Thanks a lot for your help.



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [OT] Evaluate strings in bash

2008-08-20 Thread Chuck Swiger

On Aug 20, 2008, at 9:31 AM, Matias Surdi wrote:

I've the following variable:

[code]
# 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

#
[/code]

It's a string wich includes a commmand.

How can I get the subcommand replaced by its output?


I think you're looking for "eval $BINMAKE"...?

--
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [OT] Evaluate strings in bash

2008-08-20 Thread Oliver Fromme
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`

By the way, this has nothing to do with bash.  Those things
work with every bourne shell, including FreeBSD's /bin/sh.
It even works with Solaris' /bin/sh which is very far from
a POSIX shell.  :-)

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"C++ is the only current language making COBOL look good."
-- Bertrand Meyer
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"