Quote $@ in bash scripts

This commit is contained in:
Peter Cai 2022-10-10 14:53:26 -04:00
parent c9c4f16860
commit 1457458ab8
2 changed files with 7 additions and 7 deletions

View File

@ -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"

View File

@ -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 "$@"