tmux/regress/if-shell-TERM.sh

31 lines
679 B
Bash
Raw Normal View History

2017-04-25 12:37:03 +00:00
#!/bin/sh
# 882
2017-04-25 12:50:44 +00:00
# TERM should come from outside tmux for if-shell from the config file
2017-04-25 12:37:03 +00:00
PATH=/bin:/usr/bin
TERM=screen
2017-04-25 13:30:58 +00:00
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
2017-04-25 12:37:03 +00:00
TMUX="$TEST_TMUX -Ltest"
$TMUX kill-server 2>/dev/null
TMP=$(mktemp)
trap "rm -f $TMP" 0 1 15
cat <<EOF >$TMP
if '[ "\$TERM" = "xterm" ]' \
'set -g default-terminal "vt220"' \
'set -g default-terminal "ansi"'
EOF
TERM=xterm $TMUX -f$TMP new -d "echo \"#\$TERM\" >>$TMP" || exit 1
sleep 1 && [ "$(tail -1 $TMP)" = "#vt220" ] || exit 1
TERM=screen $TMUX -f$TMP new -d "echo \"#\$TERM\" >>$TMP" || exit 1
sleep 1 && [ "$(tail -1 $TMP)" = "#ansi" ] || exit 1
$TMUX has 2>/dev/null && exit 1
exit 0