bug-bash
[Top][All Lists]
Advanced

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

Re: Spaces in args, escapes, and command substitution


From: Andreas Schwab
Subject: Re: Spaces in args, escapes, and command substitution
Date: Tue, 24 Oct 2006 18:06:10 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

bash@zacglen.com writes:

>     For example, "vi `grep -l *.c`" is fine so long as there are no spaces
>     in the *.c filenames.  But if there are, then the split on space
>     that command subsitution does messes everything up.
>
>     Given that "grep -l" outputs newline-delimited result then surely there
>     should it should be possibly to have the spaces on each line escaped
>     and only the newlines converted to spaces.

Word splitting is controlled by IFS.  Use IFS=$'\n' to only split on
newlines.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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