aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-07-17 00:14:49 +0200
committerMattias Andrée <maandree@operamail.com>2012-07-17 00:14:49 +0200
commit0ee48b90dec3c9c9a352d2060d7e477142fcc80c (patch)
treed1826917c9d724c3a1a7ab3c09f5bc87d4914deb /ponysay
parent96661759901c2e8a9110bb93574c0b33743b65e7 (diff)
downloadponysay-0ee48b90dec3c9c9a352d2060d7e477142fcc80c.tar.gz
ponysay-0ee48b90dec3c9c9a352d2060d7e477142fcc80c.tar.bz2
ponysay-0ee48b90dec3c9c9a352d2060d7e477142fcc80c.zip
using tail instread of tac | head | tac
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay16
1 files changed, 10 insertions, 6 deletions
diff --git a/ponysay b/ponysay
index dc36713..27ddfc5 100755
--- a/ponysay
+++ b/ponysay
@@ -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