If the password contains a backslash, the output doubles the number of backslashes.
abc*# becomes abc\*#
I’m aware extra escape characters are only for display purposes, and not actually sent to the command.
But the distorted password output prevents the script from accessing the database. When I remove the backslash from the password, the script works again.
Is there a way to output a shell command using grep, cat or awk that doesn’t cause this distortion?
As much as I like them I would recommend against grep/cat/awk in this
case as it makes things very fragile.
Instead try to use something that PHP and ansible can both use - such as JSON.
Thanks for the feedback. Your code works with all special characters that I’ve used, but I run into a problem when there are two backslashes (\) side-by-side in a password.