From a648fb8e46e2b2dea8133c246d9157757f70f6ca Mon Sep 17 00:00:00 2001 From: Dan OBoyle Date: Sun, 28 Jun 2015 19:26:47 -0400 Subject: [PATCH] Added / Pruned quotes and separated local variable declaration from assignment. --- bin/_blackbox_common.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/bin/_blackbox_common.sh b/bin/_blackbox_common.sh index fb93f18..1f43b6e 100755 --- a/bin/_blackbox_common.sh +++ b/bin/_blackbox_common.sh @@ -105,7 +105,7 @@ function fail_if_not_on_cryptlist() { if ! is_on_cryptlist "$name" ; then echo "ERROR: $name not found in $BB_FILES" >&2 - echo "PWD="$(/bin/pwd) >&2 + echo "PWD=""$(/bin/pwd)" >&2 echo 'Exiting...' >&2 exit 1 fi @@ -131,12 +131,12 @@ function get_pubring_path() { # Output the unencrypted filename. function get_unencrypted_filename() { - echo $(dirname "$1")/$(basename "$1" .gpg) | sed -e 's#^\./##' + echo "$(dirname "$1")"/"$(basename "$1" .gpg)" | sed -e 's#^\./##' } # Output the encrypted filename. function get_encrypted_filename() { - echo $(dirname "$1")/$(basename "$1" .gpg).gpg | sed -e 's#^\./##' + echo "$(dirname "$1")"/"$(basename "$1" .gpg)".gpg | sed -e 's#^\./##' } # Prepare keychain for use. @@ -150,7 +150,8 @@ function prepare_keychain() { function add_filename_to_cryptlist() { # If the name is already on the list, this is a no-op. # However no matter what the datestamp is updated. - local name=$(vcs_relative_path "$1") + local name + name=$(vcs_relative_path "$1") if file_contains_line "$BB_FILES" "$name" ; then echo "========== File is registered. No need to add to list." @@ -164,19 +165,20 @@ function add_filename_to_cryptlist() { # Removes a file from the list of encrypted files function remove_filename_from_cryptlist() { # If the name is not already on the list, this is a no-op. - local name=$(vcs_relative_path "$1") + local name + name=$(vcs_relative_path "$1") if ! file_contains_line "$BB_FILES" "$name" ; then - echo ========== File is not registered. No need to remove from list. + echo "========== File is not registered. No need to remove from list." else - echo ========== Removing file from list. + echo "========== Removing file from list." remove_line "$BB_FILES" "$name" fi } # Print out who the current BB ADMINS are: function disclose_admins() { - echo ========== blackbox administrators are: + echo "========== blackbox administrators are:" cat "$BB_ADMINS" } @@ -188,7 +190,7 @@ function encrypt_file() { encrypted="$2" echo "========== Encrypting: $unencrypted" >&2 - $GPG --use-agent --yes --trust-model=always --encrypt -o "$encrypted" $(awk '{ print "-r" $1 }' < "$BB_ADMINS") "$unencrypted" >&2 + $GPG --use-agent --yes --trust-model=always --encrypt -o "$encrypted" "$(awk '{ print "-r" $1 }' < "$BB_ADMINS")" "$unencrypted" >&2 echo '========== Encrypting: DONE' >&2 } @@ -200,7 +202,7 @@ function decrypt_file() { encrypted="$1" unencrypted="$2" - echo '========== EXTRACTING ''"'$unencrypted'"' >&2 + echo "========== EXTRACTING $unencrypted" >&2 old_umask=$(umask) umask "$DECRYPT_UMASK" @@ -425,15 +427,15 @@ function vcs_commit() { } # Mercurial function vcs_commit_hg() { - hg commit -m"$@" + hg commit -m "$@" } # Git function vcs_commit_git() { - git commit -m"$@" + git commit -m "$@" } # Subversion function vcs_commit_svn() { - svn commit -m"$@" + svn commit -m "$@" } # Perforce function vcs_commit_p4() {