Imported from ../bash-2.0.tar.gz.
[platform/upstream/bash.git] / examples / scripts.noah / prompt.bash
1 # prompt.bash
2 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
3 # Created: 1992-01-15
4 # Public domain
5
6 # $Id: prompt.bash,v 1.2 1994/10/18 16:34:35 friedman Exp $
7
8 # Commentary:
9 # Code:
10
11 #:docstring prompt:
12 # Usage: prompt [chars]
13 #
14 # Various preformatted prompt strings selected by argument.  For a
15 # list of available arguments and corresponding formats, do 
16 # `type prompt'. 
17 #:end docstring:
18
19 ###;;;autoload
20 function prompt ()
21 {
22     case "$1" in
23     d)     PS1='$(dirs) \$ '               ;;
24     n)     PS1='\$ '                       ;;
25     hsw)   PS1='\h[$SHLVL]: \w \$ '        ;;
26     hw)    PS1='\h: \w \$ '                ;;
27     sh)    PS1='[$SHLVL] \h\$ '            ;;
28     sw)    PS1='[$SHLVL] \w \$ '           ;;
29     uh)    PS1='\u@\h\$ '                  ;;
30     uhsHw) PS1='\u@\h[$SHLVL]:\#: \w \$ '  ;;
31     uhsw)  PS1='\u@\h[$SHLVL]: \w \$ '     ;;
32     uhw)   PS1='\u@\h: \w \$ '             ;;
33     uw)    PS1='(\u) \w \$ '               ;;
34     w)     PS1='\w \$ '                    ;;
35     esac
36 }
37
38 provide prompt
39
40 # prompt.bash ends here