mirror of
https://github.com/erkin/ponysay.git
synced 2025-02-07 13:36:43 +01:00
using tail instread of tac | head | tac
This commit is contained in:
parent
9666175990
commit
0ee48b90de
1 changed files with 10 additions and 6 deletions
12
ponysay
12
ponysay
|
@ -92,19 +92,23 @@ say() {
|
|||
fi
|
||||
}
|
||||
|
||||
function htrunc
|
||||
{
|
||||
if [ "$PONYSAY_SHELL_LINES" = "" ]; then
|
||||
PONYSAY_SHELL_LINES=2
|
||||
fi
|
||||
function htrunchead
|
||||
{
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue