public inbox for speakup@linux-speakup.org
 help / color / mirror / Atom feed
* quick tip #1: including subshell number in prompt
@  Tyler Spivey
  0 siblings, 0 replies; only message in thread
From: Tyler Spivey @  UTC (permalink / raw)
  To: speakup

ok -- just a quicky:
if you've ever been in a text editor or another program, shelled out to
another instance of bash,
and forgot the editor was there, you might have logged out of all consoles
or ran ps and found it.
but if you're running screen like i do, i don't log out for weeks, and miss
those editors until i shut down for something.
so, you can add the variable $SHLVL to y our prompt, so your
shell level will be displayed. if you're using screen, and it's not your
login shell, you ight want to:
export SHLVL=0
so that screen's shells will have level 1, and all subshells will have level
2 or more.
otherwise, screen will have level 2, and other subshells will have level 3.
this might apply to ther situations.
now onto the meat of this rather long quick tip:
you can set the variable in your prompt for example:
export PS1="\h:\w [$SHLVL]\$"
so you'll get a prompt like:
fast:~ [1]$
or if you were in a subshell, 1 level deep (from an editor or such):
fast:/directory [2]$
if you have any questions, just ask - i'll help if i can.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~ UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
 quick tip #1: including subshell number in prompt Tyler Spivey

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 read-only IMAP folder(s) and NNTP newsgroup(s).