Quote $@ in bash scripts

master
Peter Cai 2 months ago
parent c9c4f16860
commit 1457458ab8
  1. 12
      gocrypt.bash
  2. 2
      pass-test

@ -73,7 +73,7 @@ gocrypt_close() {
gocrypt_delegate() {
gocrypt_open_check
# Delegate command to another `pass` instance that manages what is inside of the mountpoint
PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" pass $@
PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" pass "$@"
# Commit if there has been changes due to this operation
pass git add "$gocrypt_dir"
pass git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
@ -152,23 +152,23 @@ case "$1" in
;;
init)
shift
gocrypt_init $@
gocrypt_init "$@"
;;
open)
shift
gocrypt_open $@
gocrypt_open "$@"
;;
crypt)
shift
gocrypt_crypt $@
gocrypt_crypt "$@"
;;
close)
shift
gocrypt_close $@
gocrypt_close "$@"
;;
ls|list|grep|find|search|show|insert|add|edit|generate|rm|remove|delete|mv|rename|cp|copy|git)
# No shift here since we need to delegate these commands to another pass instance
gocrypt_delegate $@
gocrypt_delegate "$@"
;;
*)
gocrypt_die "Unknown command $1 for gocrypt"

@ -1,3 +1,3 @@
#!/usr/bin/env sh
PASSWORD_STORE_DIR=$PWD/pass PASSWORD_STORE_EXTENSIONS_DIR=$PWD PASSWORD_STORE_ENABLE_EXTENSIONS=true pass $@
PASSWORD_STORE_DIR=$PWD/pass PASSWORD_STORE_EXTENSIONS_DIR=$PWD PASSWORD_STORE_ENABLE_EXTENSIONS=true pass "$@"

Loading…
Cancel
Save