How do I redirect output to a variable in shell? [duplicate]

Use the $( ... ) construct:

hash=$(genhash --use-ssl -s $IP -p 443 --url $URL | grep MD5 | grep -c $MD5)

Leave a Comment