I am using openssl to encrypt data in a file.
In the process of assigning the data in that file to shell variables, I am dynamically decrypting the file and attempting to use awk to parse it into variables.
$ myuser=$(echo | awk '{print $1}' | openssl aes-256-cbc -in encrypted -pass file:../password.txt -d)
$ echo $myuser
Bruce-Wayne Batman 0.0.0.0
I should just be echoing Bruce-Wayne but somehow my awk instruction is not working as well as I expect.
Can anyone offer an insight?
You seem to have your piping muddled:
That is you want the first field in
Bruce-Wayne Batman 0.0.0.0which is effectively:Doing
echo | awk '{print $1}'is the same as doingechoyou are piping the output ofecho(which is nothing) intoawk.