history (337B)
1#!/bin/sh 2 3file="$HISTORYFILE" 4test -f "$file" || exit 1 5 6xmenu() { 7 dmenu -l 20 -p 'History: ' 8} 9 10climenu() { 11 slmenu -l 20 -p 'History: ' 12} 13 14if test x"$DISPLAY" = x""; then 15 clear >&2 16 line=$(tail -n 100 "$file" | tac | climenu) 17else 18 line=$(tail -n 100 "$file" | tac | xmenu) 19fi 20 21if test x"$line" != x""; then 22 printf '%s' "$line" 23fi