Merge branch 'obsd-master'
[tmux.git] / regress / if-shell-TERM.sh
blob5967a58f17aee3bc2911de1e60274648127ad96f
1 #!/bin/sh
3 # 882
4 # TERM should come from outside tmux for if-shell from the config file
6 PATH=/bin:/usr/bin
7 TERM=screen
9 [ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
10 TMUX="$TEST_TMUX -Ltest"
11 $TMUX kill-server 2>/dev/null
13 TMP=$(mktemp)
14 trap "rm -f $TMP" 0 1 15
16 cat <<EOF >$TMP
17 if '[ "\$TERM" = "xterm" ]' \
18 'set -g default-terminal "vt220"' \
19 'set -g default-terminal "ansi"'
20 EOF
22 TERM=xterm $TMUX -f$TMP new -d "echo \"#\$TERM\" >>$TMP" || exit 1
23 sleep 1 && [ "$(tail -1 $TMP)" = "#vt220" ] || exit 1
25 TERM=screen $TMUX -f$TMP new -d "echo \"#\$TERM\" >>$TMP" || exit 1
26 sleep 1 && [ "$(tail -1 $TMP)" = "#ansi" ] || exit 1
28 $TMUX has 2>/dev/null && exit 1
30 exit 0