[英]What does bash do here in this ssh command?
ssh -i host 'scripts/myScript start; bash'
shell腳本中的函數start在哪里? 在此處將bash附加到腳本有什么作用? 一點背景知識:它為我提供了一個交互式shell,並執行myScript,就像使用純ssh實際登錄到主機一樣。 如果我省略bash的話。
ssh -i host 'scripts/myScript start;'
它不會導致交互式登錄,但是會導致非交互式shell登錄,並且由於環境變量問題,myScript無法按預期運行。
尾隨bash
會導致啟動的交互式會話bash
在遠程主機上的命令后, scripts/myScript start
回報。
另外,您需要使用-t
分配偽終端:
ssh -t host 'scripts/myScript start; bash'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.