Passing variables in remote ssh command

前端 未结 7 1687
余生分开走
余生分开走 2020-12-04 11:59

I want to be able to run a command from my machine using ssh and pass through the environment variable $BUILD_NUMBER

Here\'s what I\'m trying:



        
7条回答
  •  醉梦人生
    2020-12-04 12:18

    The list of accepted environment variables on SSHD by default includes LC_*. Thus:

    LC_MY_BUILDN="1.2.3" ssh -o "SendEnv LC_MY_BUILDN" ssh-host 'echo $LC_MY_BUILDN'
    1.2.3
    

提交回复
热议问题