aboutsummaryrefslogtreecommitdiff
path: root/pq4ps
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-18 01:56:08 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-18 01:56:08 +0200
commit532ab6c6ee1e529cc98e4d85cd27d5664d2752ac (patch)
tree5b442a4dff2df7f8dc765b3ca9dbe0970442c1d7 /pq4ps
parent65409b446bcac6bb2a2a5dee3c146fb92e71ba31 (diff)
downloadponysay-532ab6c6ee1e529cc98e4d85cd27d5664d2752ac.tar.gz
ponysay-532ab6c6ee1e529cc98e4d85cd27d5664d2752ac.tar.bz2
ponysay-532ab6c6ee1e529cc98e4d85cd27d5664d2752ac.zip
but i wasn't prepared for this
Diffstat (limited to 'pq4ps')
-rwxr-xr-xpq4ps14
1 files changed, 6 insertions, 8 deletions
diff --git a/pq4ps b/pq4ps
index 513bcec..576a4e8 100755
--- a/pq4ps
+++ b/pq4ps
@@ -1,26 +1,24 @@
-#!/bin/bash
+#!/usr/bin/env 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
+if [ $# == 1 ] && ([ "$1" == '-l' ] || [ "$1" == '--list' ]); then
perl "$0.pl" "$INSTALLDIR" | cut -d @ -f 1 | uniq
else
_ponies="$(perl "$0.pl" "$INSTALLDIR")"
ponies=()
- if (( $# > 1 )); then
+ if (( $# > 0 )); then
p=()
for arg in "$@"; do
- p+=( $(echo "$_ponies" | grep "^$arg@") )
+ p+="$(echo "$_ponies" | grep "^$arg@") "
done
_ponies=$p
fi
- for _pony in $_ponies; do
- ponies+=( $_pony )
- done
+ ponies=( $_ponies )
- if [[ ${#ponies[@]} == 0 ]]; then
+ if (( ${#ponies[@]} == 0 )); then
ponies=()
for arg in "$@"; do
ponies+=( "$arg" )