functions: Add a sleep before changing command history.
[techtalk-pse.git] / examples / simple / functions
1 # -*- shell-script -*-
2
3 # Need a short sleep to allow the previous shell to exit, possibly
4 # writing to the history file, before we start the new shell.  Could
5 # write to a different history file each time which would avoid this.
6 sleep 1
7
8 export PS1="$ "
9 export HISTFILE=/tmp/history
10
11 rm -f $HISTFILE
12
13 add_history ()
14 {
15     echo "$@" >> $HISTFILE
16 }
17
18 terminal ()
19 {
20     exec \
21         gnome-terminal \
22         --window \
23         --geometry=+100+100 \
24         --hide-menubar \
25         --disable-factory \
26         -e '/bin/bash --norc' \
27         "$@"
28 }