From e15adc242d9838114efb39eee1a2f88a34579e44 Mon Sep 17 00:00:00 2001 From: Lilian Besson Date: Fri, 15 Dec 2017 10:16:09 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Typo=20furure=20=E2=86=92=20future?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scrap_data.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrap_data.sh b/scrap_data.sh index d35e097a..11fc4f8b 100755 --- a/scrap_data.sh +++ b/scrap_data.sh @@ -6,7 +6,7 @@ bulbapedia_page_url="http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Kanto_Pok%C3%A9dex_number" bulbapedia_page_name="bulbapedia.html" -scrap_folder="`pwd`/scrapped-data" +scrap_folder="$(pwd)/scrapped-data" # Make sure the directory for the scrapped data is there. mkdir -p "$scrap_folder" @@ -18,7 +18,7 @@ if [ ! -e "scrapped-data/bulbapedia.html" ]; then echo " > Downloaded." fi -# Dear furure me, +# Dear future me, # # If you are in need to maintain this part of the code... I am # realy sorry for you (T.T). This was the best I could do... But From ea17647238012b3d20f16bec524a166fdafa5cfa Mon Sep 17 00:00:00 2001 From: Lilian Besson Date: Fri, 15 Dec 2017 10:19:29 +0100 Subject: [PATCH 2/2] Protect all strings in case of installing to a folder with a space in its name --- pokemonsay.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pokemonsay.sh b/pokemonsay.sh index 94c6e506..2f0fdca0 100755 --- a/pokemonsay.sh +++ b/pokemonsay.sh @@ -27,16 +27,16 @@ usage() { } # Where the pokemon are. -pokemon_path=`pwd`/cows +pokemon_path="$(pwd)/cows" list_pokemon() { echo "Pokémon available in '$pokemon_path/':" echo all_pokemon="$(find $pokemon_path -name "*.cow" | sort)" echo "$all_pokemon" | while read pokemon; do - pokemon=${pokemon##*/} - pokemon=${pokemon%.cow} - echo $pokemon + pokemon="${pokemon##*/}" + pokemon="${pokemon%.cow}" + echo "$pokemon" done exit 0 } @@ -108,15 +108,15 @@ fi # Define which pokemon should be displayed. if [ -n "$POKEMON_NAME" ]; then - pokemon_cow=$(find $pokemon_path -name "$POKEMON_NAME.cow") + 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. -filename=$(basename "$pokemon_cow") +filename="$(basename "$pokemon_cow")" pokemon_name="${filename%.*}" # Call cowsay or cowthink. @@ -128,5 +128,5 @@ fi # Write the pokemon name, unless requested otherwise. if [ -z "$DISPLAY_NAME" ]; then - echo $pokemon_name + echo "$pokemon_name" fi