The below IFS command doesn't give the expected output:
$ IFS='=' read -r key value <<< "fram-saml-idp-signing-certificate=MIIDYTCCAkmifzlwq5yziqyU04eP4wLr3cM="; echo "KEY: ${key}";echo "VALUE: ${value}"
Output:
KEY: fram-saml-idp-signing-certificate
VALUE: MIIDYTCCAkmifzlwq5yziqyU04eP4wLr3cM
The last equal sign (=) is missing.
Whereas, the below command gives the correct expected output:
$ IFS='=' read -r key value <<< "fram-saml-idp-signing-certificate=MIIDYTCCAkmifzlwq5yziqyU04eP4wLr3cM=="; echo "KEY: ${key}";echo "VALUE: ${value}"
Output:
KEY: fram-saml-idp-signing-certificate
VALUE: MIIDYTCCAkmifzlwq5yziqyU04eP4wLr3cM==
Is this a bug with IFS? How do I modify the first command so that I get the correct output when there's one equal sign(=) at the end?
-rthere. If you remove it your problem will disappear. I quote "The -r option to read prevents backslash interpretation (usually used as a backslash newline pair, to continue over multiple linesor to escape the delimiters). Without this option, any unescaped backslashes in the input will be discarded. You should almost always use the -r option with read." – Valentin Bajrami May 13 '20 at 11:13-rhas nothing to do with the delimiter set byIFS, – May 13 '20 at 11:48