2

I've I need to automate the creation of sha512 hash. I'm fairly new to bash scripting and none of the things I've read have helped me much.

This line gives me the correct hash and assigns nothing to $hashed

echo -n thingToHash | openssl dgst -sha512 -out $hashed;

This line gives me the wrong hash and also assigns nothing to $hashed

$hashed= thingToHash | openssl dgst -sha512;

I've tried several other things with similar results.

0

1 Answer 1

1

To assign to a variable: var=$(app_a | app_b)

The dollar sign is used only to read the value.

In your case:

hashed=$(echo "blah" | openssl dgst -sha512)

Then to read the value of the hash:

echo $hashed

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.