: etsh - " Force sh(1), csh(1), and other shells to exit w/ error! " <'' ;;; : : " The author of this file, J.A. Neitzel , " : " hereby grants it to the public domain. " : : : " $h/.etsh.prompt - etsh prompt preprocessor - modify to taste " : : " It's pretty simple. It organizes the elements I want in my " : " prompt. Then, it does a `. SetP string'. That's all. " : : " NOTE: Please choose / uncomment the example(s) you want, and/or " : " make the changes you wish below. " : : " usage: . $h/.etsh.prompt " : ( : " Fail if this process does not have a controlling terminal. " ) >/dev/tty if -z "$t" if { fd2 -e echo 'error: need tty name' } if { exit } if a == b : " Ensure we have a usable ETSHDIR ($d). " fd2 -ef/dev/null etshdir if $? -eq 0 goto Continue source etshdir $$ if $? -eq 0 goto Continue fd2 -e echo "$0: Error!" ; if a == b ; exit : fallthrough : Continue : " Each example has a [# (base 10, decimal) + something] " : " comment. That way, we can identify and reference them. " : : " SetP appends `% ' or `# ' to $Q for !root or root users. " : " Choose and modify as you wish to build your prompt. " set Q '\>' ; : " [0 default] - upon which to build " : set Q "' >\|/< '" ; : " [0 alternate] - that I like " : set Q "' ~\o/~ '" ; : " [0 alt alt] - another fun one " : " Change the following test as needed to add/remove 1 or " : " more tty(s) that want a simple, non-default, prompt. " if $t != /dev/ttyC0 -a $t != /dev/tty00 goto Jump : " similar to each $Q above but prepend each w/ \n or \n + $H " set Q '\n\>' ; : " [0t default] " : set Q "\n'>\|/< '" ; : " [0ta alternate] " : set Q "\n'~\o/~ '" ; : " [0tb alt alt] " : set Q "\n$H' ~\o/~ '" ; : " [0tc alt alt] " . SetP "$Q" ; goto Done : Jump echo "$t" | grep "$q$" >/dev/null if $? -eq 0 goto TtyIsEqual ( echo -n set q \" ; \ echo "$t" | cut -d/ -f3- | sed 's,tty,,' | tr -d \\n ; \ echo \" ) >$d/tty . $d/tty ; rm -f $d/tty : fallthrough : TtyIsEqual echo "$w" | grep "$h" >/dev/null if $? -ne 0 goto Jump1 unset o ( echo -n set o \" ; \ echo "$w" | sed 's,'"$h"',~,' | tr -d \\n ; echo \" ) >$d/wd . $d/wd ; rm -f $d/wd : . SetP "\n$o\n$k\($u\)\n$q$Q" ; : " [1] " . SetP "\n$o\n$u@$H\n$q$Q" ; : " [2] " : . SetP "\n\a$o\n$q$Q" ; : " [3 w/ bell] " : . SetP "\n$o\n$q$Q" ; : " [4] " : . SetP "\n$H:$q$Q" ; : " [5] " : . SetP "\n$q$Q" ; : " [6] " : . SetP "$q$Q" ; : " [7] " unset o ; goto Done : Jump1 : . SetP "\n$w\n$k\($u\)\n$q$Q" ; : " [1 companion] " . SetP "\n$w\n$u@$H\n$q$Q" ; : " [2 companion] " : . SetP "\n\a$w\n$q$Q" ; : " [3 companion w/ bell] " : . SetP "\n$w\n$q$Q" ; : " [4 companion] " : . SetP "\n$H:$q$Q" ; : " [5 identical] " : . SetP "\n$q$Q" ; : " [6 identical] " : . SetP "$q$Q" ; : " [7 identical] " : fallthrough : Done - zero status - true