Setting environment variable for one program call in bash using env

后端 未结 4 1824
失恋的感觉
失恋的感觉 2020-12-29 02:41

I am trying to invoke a shell command with a modified environment via the command env.

According to the manual

env HELLO=\'Hello World\'         


        
4条回答
  •  借酒劲吻你
    2020-12-29 02:48

    This works and is good for me

    $ MY_VAR='Hello' ANOTHER_VAR='World!!!' && echo "$MY_VAR $ANOTHER_VAR"
    Hello World!!!
    

提交回复
热议问题