From d9f84b6808fdb2e1358c0c03ab2e2557b9b97861 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 28 Apr 2021 02:25:58 +0500 Subject: [PATCH] added support for space when adding contact --- addcontact-bml.sh | 11 +++++++++-- install.sh | 0 2 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 install.sh diff --git a/addcontact-bml.sh b/addcontact-bml.sh index 4c18261..7acc357 100644 --- a/addcontact-bml.sh +++ b/addcontact-bml.sh @@ -8,15 +8,22 @@ VALID_NUMBER=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ if [ "$VALID_NUMBER" = "true" ] then - NAME=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ + ACCOUNT_NAME=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ | jq -r '.["payload"] | .name') CURRENCY=$(curl -s -b $COOKIE $BML_URL/validate/account/$ACCOUNT_NUMBER \ | jq -r '.["payload"] | .currency') - echo "Account Name: $NAME" + echo "Account Name: $ACCOUNT_NAME" echo "Currency: $CURRENCY" echo "" printf 'Contact Name: ' read -r CONTACT_NAME + if [ "$CONTACT_NAME" = "" ] + then + CONTACT_NAME=$ACCOUNT_NAME + else + : + fi + CONTACT_NAME=`echo "$CONTACT_NAME" | sed "s/ /%20/"` ADDCONTACT=$(curl -s -b $COOKIE $BML_URL/contacts \ --data-raw contact_type=IAT \ --data-raw account=$ACCOUNT_NUMBER \ diff --git a/install.sh b/install.sh old mode 100644 new mode 100755