Decades ago I made my prompt simply end with a newline, which perfectly and cleanly solves the problem of making it easy to copy and paste a whole line by multiple clicking in a terminal emulator to select the line, or by using line oriented commands in an emacs shell (or moving to the line and hitting return, which Emacs often regularly fucks up with its idiotic kludges to identify the prompt with invisible marks and regular expressions), without injecting any garbage characters into the beginning of the command line or requiring any extra mouse clicks, precision cursor targeting, or extra keystrokes.

Using “;” or any other character as a prompt is an ugly hack, and doesn’t solve the problem thoroughly or cleanly. No matter what character you use as a prompt at the beginning of the line, it’s going to cause some problems, like semicolons building up each time you re-enter the line, or conflicts with built-in shell syntax (retch!), so the only logical (and most obvious) solution is not to use any characters at the beginning of the line at all, and just put the prompt on a line above on its own. There is no downside to that, unless it somehow offends your sense of aesthetics. (In which case you should get over it.) 

That’s the cleanest solution without any unpleasant side effects. I don’t understand why that solution isn’t the first thing shell users think of, and the default used by the shell — it’s so obvious. Maybe because people used to the shell are just so accustomed to having to deal with mashing together unpleasant hackey kludgy incompatible competing ad-hoc syntax that it would never occur to them that it’s possible to solve a problem by REMOVING punctuation and noise characters instead of ADDING more of them. 

-Don


On 8 Aug 2018, at 04:00, tuhs-request@minnie.tuhs.org wrote:

Send TUHS mailing list submissions to
tuhs@minnie.tuhs.org

To subscribe or unsubscribe via the World Wide Web, visit
https://minnie.tuhs.org/cgi-bin/mailman/listinfo/tuhs
or, via email, send a message with subject or body 'help' to
tuhs-request@minnie.tuhs.org

You can reach the person managing the list at
tuhs-owner@minnie.tuhs.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of TUHS digest..."
Today's Topics:

  1. Re: Origins of shell prompt suffixes % $ > # (Michael Kjörling)
  2. Re: Origins of shell prompt suffixes % $ > # (Kurt H Maier)
  3. Re: Origins of shell prompt suffixes % $ > # (arnold@skeeve.com)
  4. Re: Origins of shell prompt suffixes % $ > # (Bakul Shah)
  5. Re: Origins of shell prompt suffixes % $ > # (Michael Kjörling)
  6. Re: Origins of shell prompt suffixes % $ > # (Dave Horsfall)
  7. Re: Origins of shell prompt suffixes % $ > # (KatolaZ)
  8. Re: TUHS Digest, Vol 33, Issue 5 (Steve Johnson)
  9. Re: Origins of shell prompt suffixes % $ > # (Tony Finch)
 10. Re: Origins of shell prompt suffixes % $ > # (Pete Turnbull)
 11. Re: Origins of shell prompt suffixes % $ > # (Doug McIlroy)
 12. Re: Origins of shell prompt suffixes % $ > # (Brian Zick)
 13. Re: Origins of shell prompt suffixes % $ > # (John P. Linderman)
 14. Re: Origins of shell prompt suffixes % $ > # (Lyndon Nerenberg)
 15. Re: Origins of shell prompt suffixes % $ > # (Cág)
 16. Re: Origins of shell prompt suffixes % $ > # (arnold@skeeve.com)
 17. Re: Origins of shell prompt suffixes % $ > # (Cág)
 18. Re: Origins of shell prompt suffixes % $ > # (Brian Zick)

From: Michael Kjörling <michael@kjorling.se>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 08:54:54 CEST
To: tuhs@minnie.tuhs.org


On 6 Aug 2018 21:53 +0100, from brian@zick.io (Brian Zick):
rc uses ;

Not sure what came first, and not up to digging out the history books,
but these days, a plain `;` for a prompt has a distinct advantage in
that you can copy the whole line and paste it into another shell, and
the shell will do The Right Thing (tm) as long as (as is, I believe,
done by all of the major shells at least) it uses `;` for command
separation.

--
Michael Kjörling • https://michael.kjorling.se • michael@kjorling.se
 “The most dangerous thought that you can have as a creative person
             is to think you know what you’re doing.” (Bret Victor)




From: Kurt H Maier <khm@sciops.net>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 09:31:36 CEST
To: Brian Zick <brian@zick.io>
Cc: tuhs@minnie.tuhs.org


On Mon, Aug 06, 2018 at 09:53:33PM +0100, Brian Zick wrote:

rc uses ;

Does it?  10th edition Unix and Plan 9 rc both have ('% ' ' ') as the   
default value of $prompt.  At least that's how it's described in the
manual.  None of the v8/9/10 tarballs in the archive contain rc code,
but some contain manual source, and those describe % prompts.

I've seen other references to ; (presumably  ('; ' ' ')) as the rc
prompt but I've never seen it in the wild.  Does anyone here know what
the story is?

khm




From: arnold@skeeve.com
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 09:50:21 CEST
To: khm@sciops.net, brian@zick.io
Cc: tuhs@minnie.tuhs.org


Kurt H Maier <khm@sciops.net> wrote:

On Mon, Aug 06, 2018 at 09:53:33PM +0100, Brian Zick wrote:

rc uses ;

Does it?  10th edition Unix and Plan 9 rc both have ('% ' ' ') as the   
default value of $prompt.  At least that's how it's described in the
manual.  None of the v8/9/10 tarballs in the archive contain rc code,
but some contain manual source, and those describe % prompts.

I've seen other references to ; (presumably  ('; ' ' ')) as the rc
prompt but I've never seen it in the wild.  Does anyone here know what
the story is?

khm

I believe that Tom Duff's rc does indeed use ('% ' ' '). But I think that
Byron Rakitsis's version changed the default to ('; ' ' ') exactly for
the reason that it's copyable/pastable.

HTH,

Arnold




From: Bakul Shah <bakul@bitblocks.com>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 09:57:11 CEST
To: Kurt H Maier <khm@sciops.net>
Cc: Brian Zick <brian@zick.io>, tuhs@minnie.tuhs.org


On Tue, 07 Aug 2018 00:31:36 -0700 Kurt H Maier <khm@sciops.net> wrote:
On Mon, Aug 06, 2018 at 09:53:33PM +0100, Brian Zick wrote:

rc uses ;

Does it?  10th edition Unix and Plan 9 rc both have ('% ' ' ') as the   
default value of $prompt.  At least that's how it's described in the
manual.  None of the v8/9/10 tarballs in the archive contain rc code,
but some contain manual source, and those describe % prompts.

I've seen other references to ; (presumably  ('; ' ' ')) as the rc
prompt but I've never seen it in the wild.  Does anyone here know what
the story is?

The es shell (by Haar and Rakitzis) used ; - the reason (as
per the man page)is that a user can cut-n-paste a previous
line to rexecute it (for the same reason people use term% and
cpu% functions to execute their args).  Es syntax was derived
from rc, which may be why the confusion.




From: Michael Kjörling <michael@kjorling.se>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 10:02:56 CEST
To: tuhs@minnie.tuhs.org


On 7 Aug 2018 06:54 +0000, from michael@kjorling.se (Michael Kjörling):
the shell will do The Right Thing (tm)

I suspect I must stand corrected on this. Turns out that at least GNU
bash 4.4.12(1) seems to not like a `;` at the beginning of the command
line.

   $ /bin/bash --version | head -n1
   GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
   $ /bin/bash
   $ ; true
   bash: syntax error near unexpected token `;'
   $ echo $?
   2
   $

Hopefully other shells are more sane.

--
Michael Kjörling • https://michael.kjorling.se • michael@kjorling.se
 “The most dangerous thought that you can have as a creative person
             is to think you know what you’re doing.” (Bret Victor)




From: Dave Horsfall <dave@horsfall.org>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 10:23:37 CEST
To: The Eunuchs Hysterical Society <tuhs@tuhs.org>


On Tue, 7 Aug 2018, Michael Kjörling wrote:

Hopefully other shells are more sane.

The MacBook here runs GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16) and is equally busted, as is plain "sh" on both the Mac and FreeBSD (I can't be bothered checking the Penguin); I use ZSH on FreeBSD and it does The Right Thing (tm), as does ZSH on the Mac.

-- Dave


From: KatolaZ <katolaz@freaknet.org>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 10:37:23 CEST
To: tuhs@minnie.tuhs.org


On Tue, Aug 07, 2018 at 06:23:37PM +1000, Dave Horsfall wrote:
On Tue, 7 Aug 2018, Michael Kjörling wrote:

Hopefully other shells are more sane.

The MacBook here runs GNU bash, version 3.2.57(1)-release
(x86_64-apple-darwin16) and is equally busted, as is plain "sh" on both the
Mac and FreeBSD (I can't be bothered checking the Penguin); I use ZSH on
FreeBSD and it does The Right Thing (tm), as does ZSH on the Mac.

-- Dave

I have tried all the shells I have on my linux box. It turns out that
only ksh and zsh like a ";" at the beginning of the line. Otherwise,
bash, busybox, ash/dash, mksk, posh, and yash can't bear it.

I really don't see the point of using ";", especially if you need to
make it clear if a command needs to be run by root.

$ ;-P
sh: 1: Syntax error: ";" unexpected


--
[ ~.,_  Enzo Nicosia aka KatolaZ - Devuan -- Freaknet Medialab  ]  
[     "+.  katolaz [at] freaknet.org --- katolaz [at] yahoo.it  ]
[       @)   http://kalos.mine.nu ---  Devuan GNU + Linux User  ]
[     @@)  http://maths.qmul.ac.uk/~vnicosia --  GPG: 0B5F062F  ]
[ (@@@)  Twitter: @KatolaZ - skype: katolaz -- github: KatolaZ  ]



From: "Steve Johnson" <scj@yaccman.com>
Subject: Re: [TUHS] TUHS Digest, Vol 33, Issue 5
Date: 6 August 2018 at 23:19:31 CEST
To: "Hellwig Geisse" <hellwig.geisse@mni.thm.de>, tuhs@minnie.tuhs.org


I take a somewhat more relaxed view of what a spec should be:
It should describe a program with enough completeness that a competent
programmer could write it from the spec alone.
Each section of the spec should be capable of being tested.
If all the tests for all the sections pass, then the program is ready
for general use.

The formal systems I have seen would roll over and die when presented with
even a simple compiler.  Additionally, being able to specify that a particular
function be carried out by a heapsort, for example, would require that the
formalism could describe the heapsort and prove it correct.  These don't
grow on trees...

Steve



----- Original Message -----
From:
"Hellwig Geisse" <hellwig.geisse@mni.thm.de>

To:
<tuhs@minnie.tuhs.org>
Cc:

Sent:
Mon, 06 Aug 2018 18:30:30 +0200
Subject:
Re: [TUHS] TUHS Digest, Vol 33, Issue 5


On Mo, 2018-08-06 at 08:52 -0700, Bakul Shah wrote:
>
> What counts as a "formal spec"? Is it like Justice Potter Stewart's
> "I know it when I see it" definition or something better?
>

For me, a "formal spec" should serve two goals:
1) You can reason about the thing that is specified.
2) The spec can be "executed" (i.e., there is an
   interpreting mechanism, which lets the spec behave
   like the real thing).

Hellwig



From: Tony Finch <dot@dotat.at>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 12:45:37 CEST
To: Michael Kjörling <michael@kjorling.se>
Cc: tuhs@minnie.tuhs.org


Michael Kjörling <michael@kjorling.se> wrote:

I suspect I must stand corrected on this. Turns out that at least GNU
bash 4.4.12(1) seems to not like a `;` at the beginning of the command
line.

This is a consequence of the POSIX shell grammar, which doesn't allow
empty commands.

http://pubs.opengroup.org/onlinepubs/9699919799.2013edition/utilities/V3_chap02.html#tag_18_10

The prompt I have used since about 1997 (and I can't remember where I got
it from - somewhere on Usenet, probably) in its most distilled form is

:;

although in practice I have a load of extra fluff for username, hostname,
CWD, etc. usw.

Tony.
--
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Fair Isle, Faeroes: South or southwest 4 or 5, occasionally 6 for a time.
Slight or moderate, occasionally rough for a time. Showers. Moderate or good.



From: Pete Turnbull <pete@dunnington.plus.com>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 13:24:20 CEST
To: tuhs@minnie.tuhs.org


On 07/08/2018 09:02, Michael Kjörling wrote:
On 7 Aug 2018 06:54 +0000, from michael@kjorling.se (Michael Kjörling):
the shell will do The Right Thing (tm)
I suspect I must stand corrected on this. Turns out that at least GNU
bash 4.4.12(1) seems to not like a `;` at the beginning of the command
line.
    $ /bin/bash --version | head -n1
    GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
    $ /bin/bash
    $ ; true
    bash: syntax error near unexpected token `;'
    $ echo $?
    2
    $
Hopefully other shells are more sane.

ksh and sh on an IRIX system don't like it either:

$ ;
ksh: syntax error: `;' unexpected
$

csh and tcsh don't mind.

Of course it works in rc itself, which is the point, really, and I wonder how often anyone pasted from one shell into another.  All the rc use I've seen did indeed use "; " as the prompt, but that was all at the University of York, starting in 1993.

--
Pete
Pete Turnbull




From: Doug McIlroy <doug@cs.dartmouth.edu>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 14:34:16 CEST
To: tuhs@tuhs.org


The Bourne shell (V7) had setable PS1 (start of command) and PS2 (continuation prompts)

When PS2 came on the scene, Bob Morris noticed that it most often appeared
because of a missing close quote. Therefore he set PS2="hit interrupt".




From: Brian Zick <brian@zick.io>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 17:15:07 CEST
To: Kurt H Maier <khm@sciops.net>
Cc: tuhs@minnie.tuhs.org


rc uses ;

Does it?  10th edition Unix and Plan 9 rc both have ('% ' ' ') as the   
default value of $prompt.  At least that's how it's described in the
manual.

In NetBSD 7 the default is ';', but I don't see any reference to a default $prompt in the manual on that system. I wonder if this was a change unique to Berkeley.

B




From: "John P. Linderman" <jpl.jpl@gmail.com>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 17:52:57 CEST
To: Brian Zick <brian@zick.io>
Cc: Kurt H Maier <khm@sciops.net>, tuhs@minnie.tuhs.org


On vacation, with just an iPad keyboard, so I apologize for not doing more digging.  As I noted, when taking the blame for the Great Echo Schism, my early exposure to a hp2640 terminal that allowed “rentry” of a previous command was partly to blame. It also led me to use a PS1 ending in @, the default line-kill. When I reentered a command, the @ wiped out the prompt stuff, and only the command survived. 

On Tue, Aug 7, 2018 at 10:15 AM Brian Zick <brian@zick.io> wrote:
> > rc uses ;
>       
> Does it?  10th edition Unix and Plan 9 rc both have ('% ' ' ') as the   
> default value of $prompt.  At least that's how it's described in the
> manual.

In NetBSD 7 the default is ';', but I don't see any reference to a default $prompt in the manual on that system. I wonder if this was a change unique to Berkeley.

B



From: Lyndon Nerenberg <lyndon@orthanc.ca>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 19:35:49 CEST
To: Tony Finch <dot@dotat.at>
Cc: Michael Kjörling <michael@kjorling.se>, tuhs@minnie.tuhs.org


The prompt I have used since about 1997 (and I can't remember where I got
it from - somewhere on Usenet, probably) in its most distilled form is

:;

I forget where I stole this from. It lives in $home/lib/profile on my Plan9 machines:

# /n/sources/contrib/lyndon/prompt.rc
fn : {}
fn setprompt {
       prompt = (': '^`{cat /dev/user}^@^`{cat /dev/sysname}^':'^`{pwd}^'; '  '        ')
}
fn cd { builtin cd $* && setprompt }
setprompt





From: Cág <ca6c@bitmessage.ch>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 20:09:51 CEST
To: tuhs@minnie.tuhs.org


Brian Zick wrote:

In NetBSD 7 the default is ';', but I don't see any reference to a
default $prompt in the manual on that system.

It's not. '$' is default for sh and ksh, and '%' for csh. I think
it maybe has never been ';'.

--
caóc





From: arnold@skeeve.com
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 20:51:52 CEST
To: tuhs@minnie.tuhs.org, ca6c@bitmessage.ch


C??g <ca6c@bitmessage.ch> wrote:

Brian Zick wrote:

In NetBSD 7 the default is ';', but I don't see any reference to a
default $prompt in the manual on that system.

It's not. '$' is default for sh and ksh, and '%' for csh. I think
it maybe has never been ';'.

--
ca??c


Brian was referring to rc(1) in NetBSD.  I suspect it's Byron's rc
and I think the default there is ';'.

Arnold




From: Cág <ca6c@bitmessage.ch>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 21:00:22 CEST
To: tuhs@minnie.tuhs.org


arnold wrote:

Brian was referring to rc(1) in NetBSD.  I suspect it's Byron's rc
and I think the default there is ';'.

rc is not shipped with NetBSD. There's Byron's rc in pkgsrc, so it could
be that.

--
caóc





From: Brian Zick <brian@zick.io>
Subject: Re: [TUHS] Origins of shell prompt suffixes % $ > #
Date: 7 August 2018 at 21:06:03 CEST
To: tuhs@minnie.tuhs.org


On Tue, Aug 7, 2018, at 8:00 PM, Cág wrote:
arnold wrote:

Brian was referring to rc(1) in NetBSD.  I suspect it's Byron's rc
and I think the default there is ';'.

rc is not shipped with NetBSD. There's Byron's rc in pkgsrc, so it could
be that.

Yes, I was referring to the rc in pkgsrc.

B





_______________________________________________
TUHS mailing list
TUHS@minnie.tuhs.org
https://minnie.tuhs.org/cgi-bin/mailman/listinfo/tuhs