Why does the following not work in bash?
# ensure TEST is unsetexport TEST=''echo "Hello world!" > test.txt && TEST="$(cat test.txt)" echo "$TEST"
It always returns a blank line for some reason.
doing it on seperate lines gives the expected result:
# ensure TEST is unsetexport TEST=''echo "Hello world" > test.txtTEST=$(cat test.txt)echo "$TEST"Hello world!
how to make this work in a oneliner ?
I need this to decrypt a pgp file containing a string with special characters which I then pass to ansible
ANSIBLE_VAULT_PASSWORD="$( gpg -d ~/gpg_encrypted_vault_password_file 2>/dev/null )" ansible-playbook etc etc etc
for some reason ansible devs think storing a vault-password in a plain text file is secureand I don't like typing(or copy-pasting) long secure passwords every time I test a play, so using the gpg-agent with an encrypted file is the only secure workaround that I can come up with