The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: lyndon@orthanc.ca (Lyndon Nerenberg)
Subject: [TUHS] shell PS1/PS2 which survive cut-paste
Date: Tue, 5 Dec 2017 18:26:05 -0800	[thread overview]
Message-ID: <CBC017EB-5377-452A-A0E5-479761E04BBC@orthanc.ca> (raw)
In-Reply-To: <20171206012824.GA20970@wopr>


> On Dec 5, 2017, at 5:28 PM, Kurt H Maier <khm at sciops.net> wrote:
> 
> I've used :; and ::; to good effect. Since : is a no-op, it just inserts
> noise into the history.

This fragment lives in my ${HOME}/.env on pretty much every machine I log in to.  If you 'export ENV=${HOME}/.env' in .profile, then configure sudo/doas to pass ENV through unmolested, this will follow you as you switch uids.

 _hostname=$(hostname | sed -e 's/\.hushmail\(inc\)*\.com$//')
 awd=$(which awd 2>/dev/null)
 if [ "${awd}" == "" ] ; then
        awd=':'
 fi
 setprompt () { PS1=": $(id -un)@$_hostname:$(pwd); " ; }
 cd () { command cd "$@" && setprompt && ${awd} ; }
 setprompt

It works with pretty much every Bourne/Korn shell variant I've stumbled across.  Adjust the _hostname bit to match the domains of the systems you regularly log in to, and drop the awd bits if you don't use plan9port.

--lyndon



  reply	other threads:[~2017-12-06  2:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06  1:22 George Michaelson
2017-12-06  1:28 ` Kurt H Maier
2017-12-06  2:26   ` Lyndon Nerenberg [this message]
2017-12-06  1:30 ` Steve Nickolas
2017-12-06  3:45 ` Grant Taylor
2017-12-06  5:53 ` arnold
2017-12-06  6:01   ` George Michaelson
2017-12-06 15:14     ` Ian Zimmerman
2017-12-06  6:19   ` Dave Horsfall
2017-12-06  8:00     ` arnold
2017-12-06 23:57       ` Dave Horsfall
2017-12-07  8:33         ` arnold
2017-12-07 21:46           ` Dave Horsfall
2017-12-08  6:12             ` arnold
2017-12-07 21:54         ` Clem Cole
2017-12-08  0:31           ` Dave Horsfall
2017-12-16 17:42 ` Derek Fawcus
2017-12-17 13:12   ` Don Hopkins
     [not found] <mailman.402.1512547277.9955.tuhs@minnie.tuhs.org>
2017-12-06 11:02 ` Paul Ruizendaal
2017-12-06 12:00   ` arnold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CBC017EB-5377-452A-A0E5-479761E04BBC@orthanc.ca \
    --to=lyndon@orthanc.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).