using stty and cut (coreutils) instead of tput (ncurses) for getting terminal width

This commit is contained in:
Mattias Andrée 2012-07-05 09:24:29 +02:00
parent 348c0084a8
commit 2cc95ba021

View file

@ -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
}