diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-08-01 03:33:30 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-08-01 03:33:30 +0200 |
commit | 70c27ca36f696b12012d7f47ac3071f747b95207 (patch) | |
tree | 7fd090244f918246f179becb767511fc8afc26fd /pq4ps | |
parent | e5b783e52858ae73d26c21464952323b9e3f320a (diff) | |
download | ponysay-70c27ca36f696b12012d7f47ac3071f747b95207.tar.gz ponysay-70c27ca36f696b12012d7f47ac3071f747b95207.tar.bz2 ponysay-70c27ca36f696b12012d7f47ac3071f747b95207.zip |
some edits
Diffstat (limited to 'pq4ps')
-rwxr-xr-x | pq4ps | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,15 +1,17 @@ #!/bin/bash +INSTALLDIR="$(dirname "$(dirname "$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )")")" # Get main bash script directory's parent + if [[ $# == 1 ]] && [[ "$1" == '-l' || "$1" == '--list' ]]; then - perl $0.pl | cut -d @ -f 1 | uniq + perl "$0.pl" "$INSTALLDIR" | cut -d @ -f 1 | uniq else - _ponies="$(perl $0.pl)" + _ponies="$(perl "$0.pl" "$INSTALLDIR")" ponies=() - if [[ ! $# == 0 ]]; then - p="" + if (( $# > 1 )); then + p=() for arg in "$@"; do - p=$p$(echo "$_ponies" | grep "^$arg@")" " + p+=( $(echo "$_ponies" | grep "^$arg@") ) done _ponies=$p fi @@ -32,7 +34,7 @@ else p="$(echo $pony | cut -d '@' -f 1)" f="$(echo $pony | cut -d '@' -f 2)" - q="$(cat "/usr/share/ponysay/quotes/$f")" + q="$(cat "$INSTALLDIR/share/ponysay/quotes/$f")" echo "-f" $p $q fi |