[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: !& error
From: |
Grisha Levit |
Subject: |
Re: !& error |
Date: |
Sun, 20 Aug 2023 18:49:25 -0400 |
On Mon, Aug 14, 2023, 15:29 Chet Ramey <chet.ramey@case.edu> wrote:
> On 8/12/23 1:56 PM, Grisha Levit wrote:
> > The newly added support for `! &' uses the previous value of
> > the_printed_command_except_trap or segfaults if none has been made yet:
>
> Thanks for the report. You're Johnny on the spot here -- I hadn't started
> writing tests for this yet
>
Sorry if it was premature. Btw I'm not sure about the fix for this in
https://git.savannah.gnu.org/cgit/bash.git/diff/execute_cmd.c?h=devel&id=b64a7d8c
Running `! &' still causes the previous command (if any) to be displayed in
`jobs' output:
$ : FOO
$ ! &
[1] 3938
$ jobs
[1]+ Done : FOO
I think this can be addressed by having print_simple_command produce at
least an empty string even if the command has no words and no redirections.
---
diff --git a/print_cmd.c b/print_cmd.c
index 30e354d3..2bf271f4 100644
--- a/print_cmd.c
+++ b/print_cmd.c
@@ -965,6 +965,8 @@ print_simple_command (SIMPLE_COM *simple_command)
{
if (simple_command->words)
command_print_word_list (simple_command->words, " ");
+ else
+ cprintf ("");
if (simple_command->redirects)
{
- !& error, Grisha Levit, 2023/08/12
- Re: !& error, Chet Ramey, 2023/08/14
- Re: !& error,
Grisha Levit <=