In order to run a script, I currently have to do a two step process:
ssh remote_machine
./run_script
Run Code Online (Sandbox Code Playgroud)
Is it possible to setup an alias on my host machine such that I can execute an alias, for example: run_script
and it will automatically log me into the remote_machine and run the script?
Sure, I do this all the time:
alias run_script="ssh remote_machine ./run_script"
Run Code Online (Sandbox Code Playgroud)
Note that if the ./run_script
script is interactive, you'll need to allocate a TTY using the -t
flag to ssh
:
alias run_script="ssh -t remote_machine ./run_script"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
274 次 |
最近记录: |