bug-bash
[Top][All Lists]
Advanced

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

Re: command substitution and word splitting


From: Stephane Chazelas
Subject: Re: command substitution and word splitting
Date: Sat, 13 Dec 2008 11:20:33 +0000
User-agent: Mutt/1.5.16 (2007-09-19)

On Sat, Dec 13, 2008 at 09:30:27AM +0100, Andreas Schwab wrote:
> "S. Sevki Dincer" <jfcgauss@gmail.com> writes:
> 
> > i want to start building a project with ./configure --prefix=... $(myflags)
> > where myflags is an executable text file on my path. myflags has the
> > following in it:
> > printf 'CFLAGS="-O2 -fomit-frame-pointer" '
> > printf 'LDFLAGS="-Wl,-O2"'
> > now, when i do that ./configure complains for not recognizing
> > -fomit-frame-pointer option, and actually word splitting of bash ruins
> > what i wanna do. i want the word splitting of a command substitution
> > "to be careful about the quotes in the resulting expansion". is that
> > possible?
> 
> Use eval.
> 
> eval ./configure --prefix=... $(myflags)
[...]

eval "./configure --prefix=... $(myflags)"

as you don't want word splitting nor filename generation in this
case.

You could also have done:

printf 'CFLAGS=-O2 -fomit-frame-pointer|'
printf 'LDFLAGS=-Wl,-O2'

and then:

IFS='|'
set -f
./configure --prefix=... $(myflags)

Or:

cat << EOF
CFLAGS=-O2 -fomit-frame-pointer
LDFLAGS=-Wl,-O2
EOF

and then:

IFS='
'
set -f
./configure --prefix=... $(myflags)

-- 
Stéphane




reply via email to

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