[CentOS] Special characters in bash strings

Fri Jul 8 02:09:37 UTC 2022
H <agents at meddatainc.com>

On 07/06/2022 10:42 PM, Gordon Messmer wrote:
> On 7/6/22 18:41, H wrote:
>> To my consternation this worked fine in some places but not in others.
>
>
> It might be easier to explain if you had an example of where it worked.  The bash man page has a section titled "EXPANSION" that details the order in which expansions happen.  Since tilde expansion happens before variable expansion, the case you're discussing shouldn't work in any context (other than an eval or equivalent).
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos

Thank you, I read up on bash expansion of tilde and realized substituting $HOME for ~ would be the best. Once I had done that the script worked.

The reason it worked in some places may have been that I had set the script to POSIX compliant using:

set +o posix