From 36a6e1c808ba2741b0cc5534dfb3e455bdf2730b Mon Sep 17 00:00:00 2001 From: mizukisonoko Date: Mon, 11 Dec 2017 19:03:24 +0900 Subject: [PATCH 1/3] Fix pokemonsay.sh around shuf command --- pokemonsay.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pokemonsay.sh b/pokemonsay.sh index 94c6e506..b3dd3658 100755 --- a/pokemonsay.sh +++ b/pokemonsay.sh @@ -106,13 +106,20 @@ if [ -n "$WORD_WRAP" ]; then word_wrap="-W $WORD_WRAP" fi +# Support MacOS +if [ "$(uname)" == 'Darwin' ]; then + SHUF=gshuf +else + SHUF=gshuf +fi + # Define which pokemon should be displayed. if [ -n "$POKEMON_NAME" ]; then pokemon_cow=$(find $pokemon_path -name "$POKEMON_NAME.cow") elif [ -n "$COW_FILE" ]; then pokemon_cow="$COW_FILE" else - pokemon_cow=$(find $pokemon_path -name "*.cow" | shuf -n1) + pokemon_cow=$(find $pokemon_path -name "*.cow" | $SHUF -n1) fi # Get the pokemon name. From 825b648031e9d05a26325d54aebdb088a9f2f2f9 Mon Sep 17 00:00:00 2001 From: mizukisonoko Date: Mon, 11 Dec 2017 19:05:27 +0900 Subject: [PATCH 2/3] Add install text to README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9c76cbe0..f3e77a8b 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ It may be necessary to logout and login back again to have `pokemonsay` in you ` You can install `pokemonsay` through Homebrew. It is pretty straightforward: ```sh +$ brew install coreutils # to use gshuf $ brew tap possatti/possatti $ brew install pokemonsay ``` From 6c310135cdba4a71d8c1ea0f77432b1c75b7f43f Mon Sep 17 00:00:00 2001 From: mizukisonoko Date: Mon, 11 Dec 2017 19:08:58 +0900 Subject: [PATCH 3/3] Fix script --- pokemonsay.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemonsay.sh b/pokemonsay.sh index b3dd3658..0d6f68cd 100755 --- a/pokemonsay.sh +++ b/pokemonsay.sh @@ -110,7 +110,7 @@ fi if [ "$(uname)" == 'Darwin' ]; then SHUF=gshuf else - SHUF=gshuf + SHUF=shuf fi # Define which pokemon should be displayed.