problem with echoing script variable to gpg
While this shell command echo -n "net.berrysoft.dib.Game" | gpg --print-md sha1 gives me the correct response, when I try to do this in a script using ${1}: digest = $( echo -n ${1} | gpg --print-md sha1 ) echo digest I do not get the same value I have no clue why. Help. Patrick -- View this message in context: http://www.nabble.com/problem-with-echoing-script-variable-to-gpg-tp21068924p21068924.html Sent from the Gnu - Bash mailing list archive at Nabble.com.
Re: problem with echoing script variable to gpg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to pwaugh on 12/18/2008 1:49 AM: > digest = $( echo -n ${1} | gpg --print-md sha1 ) > echo digest > > I do not get the same value I have no clue why. Help. Too much whitespace, and a misunderstanding about how shell variables work. You want: digest=$( echo -n "$1" | gpg --print-md sha1 ) echo "$digest" - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklKq0EACgkQ84KuGfSFAYCFRgCgpsZf3FyDYGAn4nMaPmqIoxAq No4Anjl+kNnWGowPn+d8U6vpKSY2OV1Y =Capc -END PGP SIGNATURE-
Re: problem with echoing script variable to gpg
Thanks. Amazingly, I got it figured out shortly after, and works like a charm now. Patrick On Thu, Dec 18, 2008 at 1:57 PM, Eric Blake wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > According to pwaugh on 12/18/2008 1:49 AM: >> digest = $( echo -n ${1} | gpg --print-md sha1 ) >> echo digest >> >> I do not get the same value I have no clue why. Help. > > Too much whitespace, and a misunderstanding about how shell variables > work. You want: > > digest=$( echo -n "$1" | gpg --print-md sha1 ) > echo "$digest" > > - -- > Don't work too hard, make some time for fun as well! > > Eric Blake e...@byu.net > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.9 (Cygwin) > Comment: Public key at home.comcast.net/~ericblake/eblake.gpg > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAklKq0EACgkQ84KuGfSFAYCFRgCgpsZf3FyDYGAn4nMaPmqIoxAq > No4Anjl+kNnWGowPn+d8U6vpKSY2OV1Y > =Capc > -END PGP SIGNATURE- >