mirror of
https://github.com/erkin/ponysay.git
synced 2025-03-03 16:01:27 +01:00
I tried to make it a bit more portable. I hope I didn't screw something up.
This commit is contained in:
parent
615f84ca5c
commit
2f1566b74f
1 changed files with 7 additions and 7 deletions
14
ponysay
14
ponysay
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
version=0.9
|
version=0.10
|
||||||
SYSTEMPONIES=/usr/share/ponysay/ponies
|
SYSTEMPONIES="/usr/share/ponysay/ponies"
|
||||||
HOMEPONIES="${HOME}/.ponysay/ponies"
|
HOMEPONIES="${HOME}/.ponysay/ponies"
|
||||||
pony="*"
|
pony="*"
|
||||||
wrap=
|
wrap=""
|
||||||
|
|
||||||
if [ "$TERM" = "linux" ]; then
|
if [ "$TERM" = "linux" ]; then
|
||||||
SYSTEMPONIES=/usr/share/ponysay/ttyponies
|
SYSTEMPONIES="/usr/share/ponysay/ttyponies"
|
||||||
HOMEPONIES="${HOME}/.ponysay/ttyponies"
|
HOMEPONIES="${HOME}/.ponysay/ttyponies"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ say() {
|
||||||
if [ "$PONYSAY_FULL_WIDTH" = 'no' ] || [ "$PONYSAY_FULL_WIDTH" = 'n' ] || [ "$PONYSAY_FULL_WIDTH" = '0' ]; then
|
if [ "$PONYSAY_FULL_WIDTH" = 'no' ] || [ "$PONYSAY_FULL_WIDTH" = 'n' ] || [ "$PONYSAY_FULL_WIDTH" = '0' ]; then
|
||||||
cat
|
cat
|
||||||
else
|
else
|
||||||
WIDTH=$((stty size <&2 || echo 0 0) | cut -d ' ' -f 2)
|
WIDTH=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
|
||||||
ponysaytruncater $WIDTH 2>/dev/null ||
|
ponysaytruncater $WIDTH 2>/dev/null ||
|
||||||
${HOME}/.local/bin/ponysaytruncater $WIDTH 2>/dev/null ||
|
${HOME}/.local/bin/ponysaytruncater $WIDTH 2>/dev/null ||
|
||||||
./ponysaytruncater $WIDTH 2>/dev/null ||
|
./ponysaytruncater $WIDTH 2>/dev/null ||
|
||||||
|
@ -79,7 +79,7 @@ say() {
|
||||||
if [ "$PONYSAY_SHELL_LINES" = "" ]; then
|
if [ "$PONYSAY_SHELL_LINES" = "" ]; then
|
||||||
PONYSAY_SHELL_LINES=2
|
PONYSAY_SHELL_LINES=2
|
||||||
fi
|
fi
|
||||||
head --lines=$(( $(stty size <&2 | cut -d ' ' -f 1) - $PONYSAY_SHELL_LINES ))
|
head --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 [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then
|
||||||
|
@ -106,7 +106,7 @@ do
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
if ! hash $cmd &>/dev/null; then
|
hash $cmd &>/dev/null; if [ $? -ne 0 ]; then
|
||||||
cat >&2 <<EOF
|
cat >&2 <<EOF
|
||||||
You don't seem to have the $cmd program.
|
You don't seem to have the $cmd program.
|
||||||
Please install it in order to use this wrapper.
|
Please install it in order to use this wrapper.
|
||||||
|
|
Loading…
Add table
Reference in a new issue