From b6eba787549657ed1580c0b5ad03155fe5286fb0 Mon Sep 17 00:00:00 2001 From: spinach <19keegandeppe@gmail.com> Date: Sun, 29 Jan 2023 19:23:42 -0500 Subject: [PATCH] fixed alias with spaces and printing with aliases --- bluebikes | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bluebikes b/bluebikes index bf5cc18..a7f36ae 100755 --- a/bluebikes +++ b/bluebikes @@ -5,7 +5,6 @@ usage() { cat < "$ALIASES_FILE" + # adding to file + tmp=$(cat "$ALIASES_FILE" | gojq --arg name "$ALIAS" --arg id "$STATION_ID" 'setpath([$id]; $name)') + echo "$tmp" > "$ALIASES_FILE" # printing change if [[ -z "$ALIAS" ]] ; then @@ -181,7 +178,7 @@ print_status() { id=$(printf '"%d"' $STATION_ID) ALIAS=$(cat "$ALIASES_FILE" | gojq ".$id" | tr -d '"') - if [[ "$ALIAS" != "null" ]] ; then + if [[ "$ALIAS" != "null" && ! -z "$ALIAS" ]] ; then # if there is an alias STATION_NAME="$ALIAS" fi