aboutsummaryrefslogtreecommitdiff
path: root/pq4ps
diff options
context:
space:
mode:
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" )