The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Grant Taylor <gtaylor@tnetconsulting.net>
Cc: tuhs@minnie.tuhs.org
Subject: Re: [TUHS] Shell Level...
Date: Tue, 21 Jan 2020 18:10:23 -0500	[thread overview]
Message-ID: <20200121231023.GM15860@mit.edu> (raw)
In-Reply-To: <75e10412-9719-c950-a808-19bc0a101f5a@spamtrap.tnetconsulting.net>

On Tue, Jan 21, 2020 at 01:44:07PM -0700, Grant Taylor via TUHS wrote:
> On 1/20/20 12:40 PM, Theodore Y. Ts'o wrote:
> > The normal reason why I'm starting subshells is because I need to
> > control various environment variables on an ad-hoc basis.  It might be
> > PYTHONPATH, KRB5CCNAME, GPG_AGENT_INFO, LD_LIBRARY_PATH, or some
> > combination of the above.  Back when I was regularly using Kerberos
> > root/admin bits, I had some hard-coded shell aliases to indicate
> > explicitly I was in a shell that was using my tytso/root@ATHENA.MIT.EDU
> > or tytso/admin@ATHENA.MIT.EDU kerberos tickets.
> 
> If I'm understanding you correctly, you used a sub-shell with a modified /
> task / process specific environment.  Correct?

Correct.  And I would often suspend the shell when I didn't need to
use the Kerberos administration credentials, and then go back to it
later when I did need it, and since I was often bouncing back and
forth between the sub-shell and the parent shell, having the SHLVL
displayed in the prompt for non-top-level shells was useful.

For similar reasons, my shell prompt will also display what git branch
I happen to be one.  For example:

<tytso@lambda> {/usr/projects/e2fsprogs/e2fsprogs-maint}, level 2   (debian/master)
1001% 

Says that I'm on the debian/master git branch, and "level 2" indicates
that I'm in a subshell.  (If I'm in a top level shell, no level will
be printed at all.)  The prompt also displays the hostname ("lambda"
in this case") which is super-useful to identify remote logins.

	     	 	    		  	     - Ted

  reply	other threads:[~2020-01-21 23:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-19 21:22 Grant Taylor via TUHS
2020-01-19 23:21 ` Thomas Paulsen
2020-01-20  8:15 ` markus schnalke
2020-01-20  8:39   ` Kurt H Maier
2020-01-21 20:42     ` Grant Taylor via TUHS
2020-01-20 19:40   ` Theodore Y. Ts'o
2020-01-20 23:51     ` Terry Jones
2020-01-21 20:44     ` Grant Taylor via TUHS
2020-01-21 23:10       ` Theodore Y. Ts'o [this message]
2020-01-20 23:55   ` Greg A. Woods
2020-01-21 20:46     ` Grant Taylor via TUHS
2020-01-21 23:39       ` Greg A. Woods
2020-01-20 23:43 ` Greg A. Woods

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=20200121231023.GM15860@mit.edu \
    --to=tytso@mit.edu \
    --cc=gtaylor@tnetconsulting.net \
    --cc=tuhs@minnie.tuhs.org \
    /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).