I have a script that I'm currently working on. And I've run into an issue where I need to prompt a user to enter a string, then encrypt that with sha-512, and then insert it into a specific file
So far I have:
pass= grub-crypt --sha512
Which returns the hashed value I need. However, I'm running into the issue where sed will read the special characters from the hash.
I then tried:
sed -i.bak "20i$pass" /foo/bar
But that doesn't work. I assume it's still reading the special characters when it substitutes the variable for the characters in the string. So I wanted to try and add an escape character before every character in the string like this:
However, this isn't working for me either. I'm new to sed, so any explanation would be very helpful. Thank you.