help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] How to not print command in $() when set -v is enabled?


From: Chet Ramey
Subject: Re: [Help-bash] How to not print command in $() when set -v is enabled?
Date: Mon, 10 Feb 2014 11:01:02 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 2/10/14, 10:28 AM, Greg Wooledge wrote:

> imadev:~$ bash-4.0 -v foo
> #!/bin/bash
> echo "foo $(tr a b <<< baa) bar"
> tr a b <<< baa) bar"
> tr a b <<< baa) bar
> tr a b <<< baa
> foo bbb bar
> 
> Looks like the behavior changed in 4.0.  Previous versions print the full
> line as it's read, and then the inner command, but not the two weird
> partials in between.

This changed when bash changed to implementing the Posix parsing rules for
$(...) command substitutions, which require that the commands between the
parens be parsed on the fly to find the closing paren, then parsed again
in the subshell begun to execute them.  This is fairly difficult to do
using a yacc-based parser.  I will take a look at suppressing at least
one of these displays.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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