From 9defdd399a2e34d6a2c004e44825046568baf0ec Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Fri, 6 Apr 2018 14:13:38 -0700 Subject: [PATCH] Fix Shellcheck bugs in Gerrit Auth Script Change-Id: I7d1846fe50274576e71e30c2bdeeef7578722b04 Signed-off-by: Trevor Bramwell --- gerrit-auth.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gerrit-auth.sh b/gerrit-auth.sh index 67fc93e..a4ccef4 100755 --- a/gerrit-auth.sh +++ b/gerrit-auth.sh @@ -18,7 +18,7 @@ exit 1 function print_repos() { # Print out a list of array elements - local repos=($@) + local repos=("$@") for repo in "${repos[@]}"; do echo -e " - $repo" done @@ -31,7 +31,7 @@ fi if [[ -s $KEYFILE ]]; then # Upload SSH Public Key curl --fail -s -L -X POST -u "sandbox:sandbox" -H "Content-type:text/plain" \ - -d @$KEYFILE http://gerrit.localhost/a/accounts/self/sshkeys/ > /dev/null + -d "@$KEYFILE" http://gerrit.localhost/a/accounts/self/sshkeys/ > /dev/null # Provide guidance on curl errors if [ $? -eq 7 ]; then @@ -42,7 +42,7 @@ if [[ -s $KEYFILE ]]; then # Output future guidance if [ $? -eq 0 ]; then - KEYID=$(ssh-keygen -l -f $KEYFILE) + KEYID=$(ssh-keygen -l -f "$KEYFILE") GERRIT_REPOS="$(curl -s -L http://gerrit.localhost/projects/ \ | grep \"id\" | cut -c12- | tr -d '",')" echo -e "Successfully uploaded public keyfile:" -- 2.16.6