Re: ! in PS1 in posix mode
Linda Walsh wrote: > Haven't used ksh for some timeI thought the '!' stuff came > from csh? It seemed so pointless, since having to look up > things by command number I thought, was way too much work... searching > via a string in the line seemed so much faster... You are not thinking about the environment in which csh was designed. If you were not working on a CRT but were on a paper terminal then it wasn't possible to implement a C-r reverse-search through the command history and WYSIWYG editor. That is why we have 'ed' and 'ex' although at the time I used 'qed'. During that era CRTs were new fangled things. At the time csh was popular most of us used paper terminals! I missed the teletypes by a few years but my introduction to computing at university was on printing paper terminals. Students were only allowed on the low end paper terminals. The CRTs were reserved for faculty and grad students. (Almost all of my CS classes were on paper terminals dialing a rotary phone with an acoustic coupler at 300 bps to a Honeywell. "Brrappph" was the sound the terminal made as it printed out lines of paper. It would shake the table as the print head on the carriage moved back and forth. Working in the computer lab was very LOUD back then. Especially in a room full of other people all working with the same type of terminals.) In that environment the !67 type of commands make a lot of sense. One always put the command number in the prompt so that it was printed out with the command. Once run that number would always be unchanged forever on the paper and easy to see and know exactly what was going to happen. Just look over the printed out history on the paper and select some program arguments from one command and other arguments from other commands and stitch them together. Since they were all in the growing roll of trash piling up out of the back to the terminal it was fairly easy to do. Take a pen and underline the numbers you used often in that session to make them easier to see. Bob
Re: ! in PS1 in posix mode
Chet Ramey wrote: On 10/12/15 7:02 PM, Linda Walsh wrote: It happens in posix mode. --- How lame! It's a '!' in a quoted string. Another example of posix braindeath -- how long before people realize that the thing branded 'posix' now isn't the real posix that was started to *describe* behaviors, not prescribe or proscribe behaviors. Do you realize that this prompt expansion was in ksh since at least ksh-86? ksh-88 was one of the Posix base documents, and that expansion was estabished behavior by the time Posix started its work. --- Haven't used ksh for some timeI thought the '!' stuff came from csh? It seemed so pointless, since having to look up things by command number I thought, was way too much work... searching via a string in the line seemed so much faster... For stuff I typed last week or earlier, I'd use grep on the hist files. I thought to have all my hist files merged and deduped... but the resulting master hist file -- .. I used it for a while (somewhat accidently as it was renamed to a normal hist file @ around 2-3M in length). command response was quite slow (took a while to figure out it was the history updating every command that caused a delay of about 2-3 seconds/command). I don't think I have all the kinks in the combining routines worked out yet either... but certainly wouldn't want to switch to the newest master @ 6.4M until history updating is sped up a bit... (I'm not holding my break... at least I can still browse/grep it by tty#)...
Re: ! in PS1 in posix mode
On 10/12/15 7:02 PM, Linda Walsh wrote: >> It happens in posix mode. > --- > How lame! It's a '!' in a quoted string. Another example > of posix braindeath -- how long before people realize that the > thing branded 'posix' now isn't the real posix that was started > to *describe* behaviors, not prescribe or proscribe behaviors. Do you realize that this prompt expansion was in ksh since at least ksh-86? ksh-88 was one of the Posix base documents, and that expansion was estabished behavior by the time Posix started its work. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: ! in PS1 in posix mode
Chet Ramey wrote: On 10/12/15 12:28 PM, Linda Walsh wrote: Chet Ramey wrote: On 10/11/15 1:37 AM, isabella parakiss wrote: In posix mode, bash replaces ! in my PS1 with the history number. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_03 "The shell shall replace each instance of the character '!' in PS1 with the history file number of the next command to be typed." I've never seen that -- even when my prompt has ! in it...maybe it's cause I have histexpand 'off'? It happens in posix mode. --- How lame! It's a '!' in a quoted string. Another example of posix braindeath -- how long before people realize that the thing branded 'posix' now isn't the real posix that was started to *describe* behaviors, not prescribe or proscribe behaviors. They just bought the name -- like PacBell swallowed SW Bell and then bought the AT&T name (not the labs... just the name). So that AT&T today is really the old PacBell in new shoes... It's like its really tweaky watching a first run anime from Japan (in japanese) with a Universal logo on it... and words that it is an NBC company. (Who is now owned by Comcast). Oh well when I role my own, I think I usually leave histexpand out of it. Having to remember line numbers seems ridiculous... and I can search by hitting ESC /string (in vi mode anyway). -l
Re: ! in PS1 in posix mode
On 10/12/15 12:28 PM, Linda Walsh wrote: > > > Chet Ramey wrote: >> On 10/11/15 1:37 AM, isabella parakiss wrote: >>> In posix mode, bash replaces ! in my PS1 with the history number. >> >> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_03 >> >> >> "The shell shall replace each instance of the character '!' in PS1 with >> the history file number of the next command to be typed." > > I've never seen that -- even when my prompt has > ! in it...maybe it's cause I have histexpand 'off'? It happens in posix mode. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: ! in PS1 in posix mode
On 10/12/15, Greg Wooledge wrote: > On Mon, Oct 12, 2015 at 09:28:42AM -0700, Linda Walsh wrote: >> Chet Ramey wrote: >> >http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_03 >> > >> >"The shell shall replace each instance of the character '!' in PS1 with >> >the history file number of the next command to be typed." >> >> I've never seen that -- even when my prompt has >> ! in it...maybe it's cause I have histexpand 'off'? > > Same here. > > imadev:~$ PS1=' ! > ' > ! > > > If that's a bug, please don't "fix" it. > Out of posix mode, the history number is \! --- xoxo iza
Re: ! in PS1 in posix mode
On Mon, Oct 12, 2015 at 09:28:42AM -0700, Linda Walsh wrote: > Chet Ramey wrote: > >http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_03 > > > >"The shell shall replace each instance of the character '!' in PS1 with > >the history file number of the next command to be typed." > > I've never seen that -- even when my prompt has > ! in it...maybe it's cause I have histexpand 'off'? Same here. imadev:~$ PS1=' ! > ' ! > If that's a bug, please don't "fix" it.
Re: ! in PS1 in posix mode
Chet Ramey wrote: On 10/11/15 1:37 AM, isabella parakiss wrote: In posix mode, bash replaces ! in my PS1 with the history number. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_03 "The shell shall replace each instance of the character '!' in PS1 with the history file number of the next command to be typed." I've never seen that -- even when my prompt has ! in it...maybe it's cause I have histexpand 'off'?
Re: ! in PS1 in posix mode
On 10/11/15 2:22 AM, isabella parakiss wrote: > On 10/11/15, isabella parakiss wrote: >> In posix mode, bash replaces ! in my PS1 with the history number. >> >> $ PS1=' ! ' >> ! set -o posix >> 513 exit >> >> It doesn't happen with any other prompt escape sequence, afaict. >> This looks... intentional? WTF? >> > > Ok I've now read this page: http://tiswww.case.edu/php/chet/bash/POSIX > This is awful. > > I found out this by enabling set -o posix in my interactive shell. bash > replied with an endless loop of syntax errors because there's this in my > PS1: ${var[a != b]} > Then bash decided to eat up as much cpu and memory it could grab, and I > had to kill-9 it. > > I understand that changing the standard in unfeasible but a syntax error > in PS1 shouldn't destroy the shell. You're right. I found the code path that didn't honor the "expanding prompt string, don't jump back to the top level" flag and fixed it. Thanks. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: ! in PS1 in posix mode
On 10/11/15 1:37 AM, isabella parakiss wrote: > In posix mode, bash replaces ! in my PS1 with the history number. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_03 "The shell shall replace each instance of the character '!' in PS1 with the history file number of the next command to be typed." -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: ! in PS1 in posix mode
On 10/11/15, isabella parakiss wrote: > In posix mode, bash replaces ! in my PS1 with the history number. > > $ PS1=' ! ' > ! set -o posix > 513 exit > > It doesn't happen with any other prompt escape sequence, afaict. > This looks... intentional? WTF? > Ok I've now read this page: http://tiswww.case.edu/php/chet/bash/POSIX This is awful. I found out this by enabling set -o posix in my interactive shell. bash replied with an endless loop of syntax errors because there's this in my PS1: ${var[a != b]} Then bash decided to eat up as much cpu and memory it could grab, and I had to kill-9 it. I understand that changing the standard in unfeasible but a syntax error in PS1 shouldn't destroy the shell. --- xoxo iza
! in PS1 in posix mode
In posix mode, bash replaces ! in my PS1 with the history number. $ PS1=' ! ' ! set -o posix 513 exit It doesn't happen with any other prompt escape sequence, afaict. This looks... intentional? WTF? --- xoxo iza