is there an escape character for envsubst?

后端 未结 6 1751
北海茫月
北海茫月 2020-12-29 01:28

Is there a way to prevent envsubst from substituting a $VARIABLE? For example, I would expect something like:

export THIS=THAT
echo         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 01:43

    If there's only one or two variables you don't want to expand, you can sort of whitelist them by temporarily setting them to their own name, like this:

    $ echo 'one $two three $four' | four='$four' envsubst
    one  three $four
    

    Here, the $four variable gets replaced with $four, effectively leaving it unchanged.

提交回复
热议问题