diff options
Diffstat (limited to 'pq4ps')
-rwxr-xr-x | pq4ps | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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" ) |