diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-07-17 00:14:49 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-07-17 00:14:49 +0200 |
commit | 0ee48b90dec3c9c9a352d2060d7e477142fcc80c (patch) | |
tree | d1826917c9d724c3a1a7ab3c09f5bc87d4914deb | |
parent | 96661759901c2e8a9110bb93574c0b33743b65e7 (diff) | |
download | ponysay-0ee48b90dec3c9c9a352d2060d7e477142fcc80c.tar.gz ponysay-0ee48b90dec3c9c9a352d2060d7e477142fcc80c.tar.bz2 ponysay-0ee48b90dec3c9c9a352d2060d7e477142fcc80c.zip |
using tail instread of tac | head | tac
-rwxr-xr-x | ponysay | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -92,19 +92,23 @@ say() { fi } - function htrunc + if [ "$PONYSAY_SHELL_LINES" = "" ]; then + PONYSAY_SHELL_LINES=2 + fi + function htrunchead { - if [ "$PONYSAY_SHELL_LINES" = "" ]; then - PONYSAY_SHELL_LINES=2 - fi head --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES )) } + function htrunctail + { + tail --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES )) + } if [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then - exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | tac | htrunc | tac + exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunctail else - exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunc + exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunchead fi else exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc |