From owner-freebsd-questions@FreeBSD.ORG Thu Aug 21 10:39:54 2008 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A81C1065682 for ; Thu, 21 Aug 2008 10:39:54 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 97D378FC16 for ; Thu, 21 Aug 2008 10:39:53 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.2/8.14.2) with ESMTP id m7LAdnRL092338; Thu, 21 Aug 2008 12:39:51 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.2/8.14.2/Submit) id m7LAdnhk092337; Thu, 21 Aug 2008 12:39:49 +0200 (CEST) (envelope-from olli) Date: Thu, 21 Aug 2008 12:39:49 +0200 (CEST) Message-Id: <200808211039.m7LAdnhk092337@lurza.secnetix.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG, matiassurdi@gmail.com In-Reply-To: X-Newsgroups: list.freebsd-questions User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.3-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Thu, 21 Aug 2008 12:39:52 +0200 (CEST) Cc: Subject: Re: [OT] Evaluate strings in bash X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@FreeBSD.ORG, matiassurdi@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2008 10:39:54 -0000 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