bug-bash
[Top][All Lists]
Advanced

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

Here-doc lines not echoed in "source" in verbose mode


From: Eduardo Ochs
Subject: Here-doc lines not echoed in "source" in verbose mode
Date: Mon, 11 Sep 2006 02:28:46 -0300

Hello list,

There's one situation in which I prefer zsh's behaviour over bash's...
Can anyone help me to make bash behave like zsh in this case? The fix
doesn't need to be a pure shell thing, there's no problem if I need
to patch the C source locally, I can keep a patched bash in ~/bin/, as
this is just for interactive use...

Here it is: when "verbose" mode is on (i.e., after "set -v") then
"source"ing (a.k.a. "."-ing) a script in zsh outputs all the script
lines and, as they are executed, also their output; doing the same in
bash outputs the script lines _minus the ones that belong to
here-documents_, plus their outputs. Here's an example:


 /home/edrx(zsh)$ # Prepare the temporary script
 /home/edrx(zsh)$ cat > /tmp/ee.sh <<'%%%'
 > cd /tmp/
 > rev <<'---'
 > foo
 > bar
 > ---
 > echo $[1+2]
 > %%%
 /home/edrx(zsh)$
 /home/edrx(zsh)$ # Make 'ee' run it in verbose mode
 /home/edrx(zsh)$ function ee () { set -v; . /tmp/ee.sh; set +v; }
 /home/edrx(zsh)$
 /home/edrx(zsh)$ # Run it - note how in zsh the here-doc lines
 /home/edrx(zsh)$ # ARE echoed
 /home/edrx(zsh)$ ee
 cd /tmp/
 rev <<'---'
 foo
 bar
 ---
 oof
 rab
 echo $[1+2]
 3
 /tmp(zsh)$


 /home/edrx(bash)$ # Prepare the temporary script
 /home/edrx(bash)$ cat > /tmp/ee.sh <<'%%%'
 > cd /tmp/
 > rev <<'---'
 > foo
 > bar
 > ---
 > echo $[1+2]
 > %%%
 /home/edrx(bash)$
 /home/edrx(bash)$ # Make 'ee' run it in verbose mode
 /home/edrx(bash)$ function ee () { set -v; . /tmp/ee.sh; set +v; }
 /home/edrx(bash)$
 /home/edrx(bash)$ # Run it - note how in bash the here-doc lines
 /home/edrx(bash)$ # are NOT echoed
 /home/edrx(bash)$ ee
 cd /tmp/
 rev <<'---'
 oof
 rab
 echo $[1+2]
 3
 /tmp(bash)$


Thanks in advance,
 Eduardo Ochs
 http://angg.twu.net/



P.S.: here are some links that explain why I need to source
temporary scripts in verbose mode...
 http://angg.twu.net/eev-article.html
 http://angg.twu.net/eev-current/eev.el.html#eev
 http://angg.twu.net/eev-current/README.html
 http://angg.twu.net/eev-current/doc/shot-f3.png




reply via email to

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