diff options
author | Kajur, Harish (vk250x) <vk250x@att.com> | 2020-02-29 22:17:05 -0500 |
---|---|---|
committer | jimmy <jf2512@att.com> | 2020-03-03 13:20:06 -0500 |
commit | 3a27813b663c34df52b2b1b50df7f0754dcfe134 (patch) | |
tree | 1f962778cd649286f70ae7ec8dbc5d868a668a7b /aai-resources/src/main/scripts/updateTool.sh | |
parent | 50315fe106b88e0cd556b8b6fab1dbdd4c9856a4 (diff) |
Update resources to use aai-common changes
Issue-ID: AAI-2750
Change-Id: I33ea2b3d7b4b706edc59c3d45c9957d05effd306
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
Diffstat (limited to 'aai-resources/src/main/scripts/updateTool.sh')
-rw-r--r-- | aai-resources/src/main/scripts/updateTool.sh | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/aai-resources/src/main/scripts/updateTool.sh b/aai-resources/src/main/scripts/updateTool.sh index e79edd1..ce0a8f6 100644 --- a/aai-resources/src/main/scripts/updateTool.sh +++ b/aai-resources/src/main/scripts/updateTool.sh @@ -129,36 +129,34 @@ fi #or #'physical-location-id:complex-id, city:New York' thirdarg=$3 -isjson = false +isjson=false if [[ "$thirdarg" == *json || "$thirdarg" == *JSON ]]; then - isjson = true + isjson=true else #For Usage 2, format input into JSON string format JSONSTRING="{" INPUT=$3 #replace any spaces with %20 - INPUT=${INPUT// /%20} + INPUT=$(echo ${INPUT} | sed 's/ /%20/g'); - for i in ${INPUT//,/ }; + for i in $(echo ${INPUT} | sed 's/,/ /g'); do #change any %20 back to space ) - i=${i//%20/ } - #echo "after change to space=$i" + i=$(echo ${i} | sed 's/%20/ /g'); #trim modstring to remove any beginning spaces (" city" becomes "city") - i="${i##*( )}" - + i=$(echo ${i} | sed 's/^[ \t]*//'); + #add JSON quotes MODSTRING=" \"$i\"," - MODSTRING=${MODSTRING//[:]/'": "'} - #echo "MODSTRING=$MODSTRING" + MODSTRING=$(echo ${MODSTRING} | sed 's/:/": "/g'); - JSONSTRING+=$MODSTRING + JSONSTRING="${JSONSTRING}${MODSTRING}" done JSONSTRING="${JSONSTRING%?}" - JSONSTRING+=" }" + JSONSTRING="${JSONSTRING} }" echo "JSON string is $JSONSTRING" fi @@ -225,4 +223,4 @@ else fi echo `date` " Done $0, returning $RC" -exit $RC
\ No newline at end of file +exit $RC |