aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-07-05 09:24:29 +0200
committerMattias Andrée <maandree@operamail.com>2012-07-05 09:24:29 +0200
commit2cc95ba021f4f295d974f51f5a4349aa370f3317 (patch)
tree820d035a06c339e229f976dd481a331373248f0b /ponysay
parent348c0084a892b6967249e26a40f529301f7172e4 (diff)
downloadponysay-2cc95ba021f4f295d974f51f5a4349aa370f3317.tar.gz
ponysay-2cc95ba021f4f295d974f51f5a4349aa370f3317.tar.bz2
ponysay-2cc95ba021f4f295d974f51f5a4349aa370f3317.zip
using stty and cut (coreutils) instead of tput (ncurses) for getting terminal width
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay7
1 files changed, 4 insertions, 3 deletions
diff --git a/ponysay b/ponysay
index 46c288e..5958387 100755
--- a/ponysay
+++ b/ponysay
@@ -66,9 +66,10 @@ say() {
if [ "$PONYSAY_FULL_WIDTH" = 'no' ] || [ "$PONYSAY_FULL_WIDTH" = 'n' ] || [ "$PONYSAY_FULL_WIDTH" = '0' ]; then
cat
else
- ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
- ${HOME}/.local/bin/ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
- ./ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
+ WIDTH=$((stty size <&2 || echo 0 0) | cut -d ' ' -f 2)
+ ponysaytruncater $WIDTH 2>/dev/null ||
+ ${HOME}/.local/bin/ponysaytruncater $WIDTH 2>/dev/null ||
+ ./ponysaytruncater $WIDTH 2>/dev/null ||
cat
fi
}