diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-08-18 01:56:08 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-08-18 01:56:08 +0200 |
commit | 532ab6c6ee1e529cc98e4d85cd27d5664d2752ac (patch) | |
tree | 5b442a4dff2df7f8dc765b3ca9dbe0970442c1d7 /pq4ps | |
parent | 65409b446bcac6bb2a2a5dee3c146fb92e71ba31 (diff) | |
download | ponysay-532ab6c6ee1e529cc98e4d85cd27d5664d2752ac.tar.gz ponysay-532ab6c6ee1e529cc98e4d85cd27d5664d2752ac.tar.bz2 ponysay-532ab6c6ee1e529cc98e4d85cd27d5664d2752ac.zip |
but i wasn't prepared for this
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" ) |