Re: issues in bash found while creating command result display

2019-04-17 Thread Chet Ramey
On 4/16/19 7:37 PM, Paul Wise wrote: > On Tue, 2019-04-16 at 14:57 -0400, Chet Ramey wrote: > >> Why take so much effort to (imperfectly) figure out and display >> things you already know? > > Correctness. If what the user knows doesn't match what the program > knows then they might think that th

Re: issues in bash found while creating command result display

2019-04-16 Thread Michael Felt (aixtools)
Sent from my iPhone > On 17 Apr 2019, at 01:37, Paul Wise wrote: > >> On Tue, 2019-04-16 at 14:57 -0400, Chet Ramey wrote: >> >> Why take so much effort to (imperfectly) figure out and display >> things you already know? > > Correctness. If what the user knows You mean think they know, bett

Re: issues in bash found while creating command result display

2019-04-16 Thread Paul Wise
On Tue, 2019-04-16 at 14:57 -0400, Chet Ramey wrote: > Why take so much effort to (imperfectly) figure out and display > things you already know? Correctness. If what the user knows doesn't match what the program knows then they might think that the program is buggy or that there is something mal

Re: issues in bash found while creating command result display

2019-04-16 Thread Chet Ramey
On 4/14/19 9:40 PM, Paul Wise wrote: >> The tool you have is the exit status of the last command. >> From that perspective, there's no difference. > > From the perspective of the user of a shell prompt there is a difference. I've been thinking about this. The user at a shell prompt is the only o

Re: issues in bash found while creating command result display

2019-04-16 Thread Chet Ramey
On 4/16/19 10:36 AM, Eric Blake wrote: > On 4/15/19 4:31 PM, Chet Ramey wrote: > >> >> The Korn shell uses values > 256 to denote `internal' shell exit statuses, >> but that violates POSIX. > > No, actually it does NOT violate POSIX. In fact, POSIX has tried hard > to permit that ksh behavior, i

Re: issues in bash found while creating command result display

2019-04-16 Thread Eric Blake
On 4/15/19 4:31 PM, Chet Ramey wrote: > > The Korn shell uses values > 256 to denote `internal' shell exit statuses, > but that violates POSIX. No, actually it does NOT violate POSIX. In fact, POSIX has tried hard to permit that ksh behavior, in particular since that extension allows an easy di

Re: issues in bash found while creating command result display

2019-04-16 Thread Chet Ramey
On 4/15/19 10:29 PM, Paul Wise wrote: > I wonder if bash could set an additional variable to indicate if $? is > from a normal exit, a signal exit, a shell keystroke etc, as well as a > corresponding equivalent array that is about PIPESTATUS. That falls apart fairly quickly for anything but the c

Re: issues in bash found while creating command result display

2019-04-15 Thread Paul Wise
On Tue, 2019-04-16 at 12:38 +0700, Robert Elz wrote: > That's really hard to do and do correctly. I was operating on the assumption that it could be done in the same way that the $? and $PIPESTATUS variables are created/updated. > There's no way to pass variables back from a subshell I think I

Re: issues in bash found while creating command result display

2019-04-15 Thread Robert Elz
Date:Tue, 16 Apr 2019 10:29:36 +0800 From:Paul Wise Message-ID: <5be7a3060ecb029ac36a4592bbee7fc071becd12.ca...@bonedaddy.net> | I wonder if bash could set an additional variable to indicate if $? is | from a normal exit, a signal exit, a shell keystroke etc, Tha

Re: issues in bash found while creating command result display

2019-04-15 Thread Paul Wise
On Mon, 2019-04-15 at 17:31 -0400, Chet Ramey wrote: > You can use $HISTCMD with a slight fix that's now in the devel branch. That doesn't increment when you use HISTCONTROL=erasedups AFAICT but the command number does increment. Also HISTCMD doesn't start at zero. > The Korn shell uses values >

Re: issues in bash found while creating command result display

2019-04-15 Thread Chet Ramey
On 4/14/19 9:40 PM, Paul Wise wrote: > On Sun, 2019-04-14 at 17:28 -0400, Chet Ramey wrote: > >> That's the number of positional parameters. > > Oops, I mean the command number variable \# that is available at PS1 > evaluation time but not when PROMPT_COMMAND is run. I was able to > workaround th

Re: issues in bash found while creating command result display

2019-04-14 Thread Paul Wise
On Sun, 2019-04-14 at 17:28 -0400, Chet Ramey wrote: > That's the number of positional parameters. Oops, I mean the command number variable \# that is available at PS1 evaluation time but not when PROMPT_COMMAND is run. I was able to workaround this by deferring the decision to display the status

Re: issues in bash found while creating command result display

2019-04-14 Thread Chet Ramey
On 4/14/19 1:28 AM, Paul Wise wrote: > Hi folks, > > I wanted a way in bash to print the status of the last command I ran, > including information about each command in a pipe and about signals. > > I noticed that bash does not have the ability to display a command > result, so I came up with the

issues in bash found while creating command result display

2019-04-14 Thread Paul Wise
Hi folks, I wanted a way in bash to print the status of the last command I ran, including information about each command in a pipe and about signals. I noticed that bash does not have the ability to display a command result, so I came up with the attached prompt configuration. I am hoping that f