Passing arguments for a remote Python script using ssh

时间:2019-04-17 00:53:47

标签: python shell ssh

Echo Enter the Report ID

read varname

ssh -t root@192.168.10.10 '
  python myscript.py --user User1 --password Password1 --report \$varname
'

I am trying pass an argument 'varname' to a remotely located python script using ssh but unable to do so. Getting an error 'Invalid report uuid provided'

Value for --report looks like as follow efc4c534-5d1d-11e9-844b-fa163e069095

1 个答案:

答案 0 :(得分:1)

varname is defined locally only, so $varname needs to be expanded:

Echo Enter the Report ID

read varname

ssh -t root@192.168.10.10 "python myscript.py --user User1 --password Password1 --report $varname"