[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inconsistent handling of quotes in backticks
From: |
Paul Jarc |
Subject: |
Re: Inconsistent handling of quotes in backticks |
Date: |
Wed, 21 Jul 2004 18:13:34 -0400 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
bronson@rinspin.com wrote:
> However, if you put quotes around the command in a backtick substitution,
> the command fails:
>
> $ `echo "\"echo\" hi"`
> bash: "echo": command not found
This is normal behavior. man bash:
Quote Removal
After the preceding expansions, all unquoted occurrences of the charac-
ters \, ', and " that did not result from one of the above expansions
are removed.
Since these " characters were the result of command substitution, they
are not removed. Maybe this is what you want:
$ eval `echo "\"echo\" hi"`
But beware that this will also process any further expansions,
redirections, etc., that may appear in the result of the command
substitution. It will be evaluated just like a top-level command.
paul