Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: capturing output of !! not working



On Mar 22,  6:35pm, Peter Stephenson wrote:
}
} As I've noted in the comment, to get this stuff to work cleanly we need
} to capture character-by-character input at a level over the history, but
} we don't have one and there are probably too many levels anyway.  So
} this will have to do --- it's at least fairly obvious what's going on.

OK, now we just need to do something similar for this:

torch% alias '{'=echo
torch% {bar
zsh: command not found: echobar
torch% fc -l
    1  alias '{'=echo
    2  {echobar

That must be the same problem as the "!!echo" in my $( !! ) example, no?

Here's a test, which I have dropped in the previously-unused "W" category
for "builtin interactive commands and constructs".  If that doesn't seem
correct, rename to D10history.


diff --git a/Test/W01history.ztst b/Test/W01history.ztst
new file mode 100644
index 0000000..2bdcc32
--- /dev/null
+++ b/Test/W01history.ztst
@@ -0,0 +1,15 @@
+# Tests for BANG_HIST replacements
+
+%test
+
+  $ZTST_testdir/../Src/zsh -fis <<<'
+  echo foo bar
+  echo $(!!) again
+  echo more $( !! )'
+0:Regression test for history references in command substitution
+>foo bar
+>foo bar again
+>more foo bar again
+*?*
+F:Check that a history bug introduced by workers/34160 is working again.
+F:Discarded line of error output consumes prompts printed by "zsh -i".

-- 
Barton E. Schaefer



Messages sorted by: Reverse Date, Date, Thread, Author