[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unwanted expansion of variable with nested strings
From: |
Paul Jarc |
Subject: |
Re: unwanted expansion of variable with nested strings |
Date: |
Thu, 04 May 2006 00:44:03 -0400 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux) |
Mike Frysinger <vapier@gentoo.org> wrote:
> $ foo="a b c"
> $ gawk 'BEGIN {foo="'${foo}'"}'
> gawk: BEGIN {foo="a
> gawk: ^ unterminated string
This is normal. man bash:
# Word Splitting
# The shell scans the results of parameter expansion, command substitu-
# tion, and arithmetic expansion that did not occur within double quotes
# for word splitting.
> so if i quote ${foo} like so:
> $ gawk 'BEGIN {foo="'"${foo}"'"}'
> it'll work in this case, but then fail if foo contains newlines:
> foo="a
> b
> c"
What do you mean by "fail"? What do you want to happen in this case?
paul