From: Steffen Nurpmeso <steffen@sdaoden.eu>
To: Greg 'groggy' Lehey <grog@lemis.com>
Cc: Rudi Blom <rudi.j.blom@gmail.com>, coff <coff@minnie.tuhs.org>
Subject: Re: [COFF] What is your prompt?
Date: Sun, 26 Dec 2021 00:43:37 +0100 [thread overview]
Message-ID: <20211225234337.cWiBV%steffen@sdaoden.eu> (raw)
In-Reply-To: <20211225231941.GB83649@eureka.lemis.com>
Greg 'groggy' Lehey wrote in
<20211225231941.GB83649@eureka.lemis.com>:
|On Friday, 24 December 2021 at 23:40:56 -0500, Theodore Ts'o wrote:
|> Here are examples of some of my prompts. It does use two lines, but
|> the extra context is worth it to me:
|>
|> <tytso@cwcc> {/home/tytso}
|> 267% cd /usr/projects/e2fsprogs/base
|
|That's actually surprisingly like mine, though I squeeze it into one
|line. Like you, I find user, system and cwd important, but also the
|tty. In addition I put a marker to help find prompts in long output,
|so a typical prompt might be:
|
| === grog@bilbo (/dev/pts/27) ~/src 6 ->
|
|That's generated with
|
| PS1="\[ESC[34m\]=== \u@\h (`tty`) \[ESC[31m\]\w\[ESC[34m\] \# ->\[ESC[30\
| m\]\[ESC[47m\] "
|
|> 272% su
|> Password:
|> <tytso.root@cwcc> {/home/tytso}, level 2
|
|That's interesting. How do you do that?
Looks like bash(1)'s $SHLVL to me.
I always stumble over the OpenCSW.org ssh(1) logins, they set
ignoreeof by default. That is how strange things go, in the shell
i hate that, in my mailer i have that and furthermore even
commandalias q 'echo You do not want to quit, do you?'
and that happens several times a week.
I mean i have
[ "${UID}" -eq 0 ] && PS1='#' || PS1='$'
if ( [ "${HISTSIZE##84}" = 42 ] ) > /dev/null 2>&1; then
# bash(1)/*ksh(1)?
if [ -n "${___SHTYPE}" ] || [ -n "${PWD}" ]; then
PS1="${ps1s}#?\$?${j}|${HOSTNAME%%.*}:\${PWD##*/}${PS1}${ps1e} "
else
PS1="${ps1s}#${j}${HOSTNAME%%.*}:${ps1W}${PS1}${ps1e} "
fi
else
PS1="${ps1s}#${j}${HOSTNAME}${PS1}${ps1e} "
fi
PS2='> '
export PS1 PS2
Where all the ps1* series was detected earlier, for colour, like
ps1s="\[\e[31m\]" ps1S="\[\e[38;5;203m\]" ps1e="\[\e[0m\]"
for bash or
eval "ps1s=\$'\e[31m' ps1S=\$'\e[38;5;203m' ps1e=\$'\e[0m'"
for mksh (to get around bugs it had sometime, and were fixed, some
get fixed by Thorsten), as well as
ps1s="^[[31m" ps1S="^[[38;5;203m" ps1e="^[[0m" # XXX \e <> OpenBSD?$
and here ^[ is indeed the fully expanded \e for those ksh's which
cannot. The $j is for shells not running in tmux, where i have
a status line with lots of infos, to get load average
[ -f /proc/loadavg ] && j="(\$(cut -f1,4 -d' ' /proc/loadavg))"
I forgot busybox sh(1) in the listing. ps1W is \W for FreeBSD and
DragonFly ash(1) things. Hm.
Maybe i have to un-bitrot that by retesting against all shells
again, it has been years, and lots of programming happens.
I usually do "scp .* HOST:" whenever i get a HOST account, and
forget about it thereafter.
A nice rest-Christmas for all Christians, shall there be some left
which Jesus would not throw out of the temple, actually, that is.
:)
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
COFF mailing list
COFF@minnie.tuhs.org
https://minnie.tuhs.org/cgi-bin/mailman/listinfo/coff
next prev parent reply other threads:[~2021-12-25 23:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-25 2:50 Rudi Blom
2021-12-25 4:40 ` Theodore Ts'o
2021-12-25 17:39 ` Steffen Nurpmeso
2021-12-25 18:28 ` Grant Taylor via COFF
2021-12-25 19:14 ` Steffen Nurpmeso
2021-12-26 3:44 ` Grant Taylor via COFF
2021-12-25 23:19 ` Greg 'groggy' Lehey
2021-12-25 23:43 ` Steffen Nurpmeso [this message]
2021-12-26 21:18 ` Theodore Ts'o
2021-12-26 21:33 ` Warner Losh
2021-12-27 1:33 ` Theodore Ts'o
2021-12-27 2:52 ` Rudi Blom
2021-12-27 3:43 ` Greg 'groggy' Lehey
2021-12-27 4:06 ` Rudi Blom
2021-12-27 4:12 ` Greg 'groggy' Lehey
2021-12-27 4:28 ` Rudi Blom
2021-12-27 18:44 ` Steffen Nurpmeso
2021-12-27 18:55 ` Warner Losh
2021-12-27 19:07 ` Grant Taylor via COFF
2021-12-27 19:25 ` Steffen Nurpmeso
2021-12-27 18:37 ` Steffen Nurpmeso
2021-12-26 3:29 ` Grant Taylor via COFF
2021-12-26 3:54 ` Greg 'groggy' Lehey
2021-12-26 5:27 ` Grant Taylor via COFF
-- strict thread matches above, loose matches on Subject: below --
2021-12-23 6:59 [COFF] What is your prompt? (was: ksh88 source code?) Andy Kosela
2021-12-24 17:17 ` [COFF] What is your prompt? Grant Taylor via COFF
2021-12-26 22:17 ` Mike Markowski
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=20211225234337.cWiBV%steffen@sdaoden.eu \
--to=steffen@sdaoden.eu \
--cc=coff@minnie.tuhs.org \
--cc=grog@lemis.com \
--cc=rudi.j.blom@gmail.com \
/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).