亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

由于stdin不是終端,因此不會分配偽終端

由于stdin不是終端,因此不會分配偽終端

鴻蒙傳說 2019-09-18 13:45:56
我正在嘗試編寫一個shell腳本,在遠程服務器上創建一些目錄,然后使用scp將文件從本地計算機復制到遠程服務器上。這是我到目前為止所擁有的:ssh -t user@server<<EOTDEP_ROOT='/home/matthewr/releases'datestamp=$(date +%Y%m%d%H%M%S)REL_DIR=$DEP_ROOT"/"$datestampif [ ! -d "$DEP_ROOT" ]; then    echo "creating the root directory"    mkdir $DEP_ROOTfimkdir $REL_DIRexitEOTscp ./dir1 user@server:$REL_DIRscp ./dir2 user@server:$REL_DIR每當我運行它時,我收到此消息:Pseudo-terminal will not be allocated because stdin is not a terminal.腳本永遠掛起。我的公鑰在服務器上是可信的,我可以在腳本之外運行所有命令。有任何想法嗎?
查看完整描述

3 回答

?
弒天下

TA貢獻1818條經驗 獲得超8個贊

即使stdin不是終端,也要嘗試ssh -t -t(或ssh -tt簡稱)強制偽tty分配。

從ssh手冊頁:


-T      Disable pseudo-tty allocation.


-t      Force pseudo-tty allocation.  This can be used to execute arbitrary 

        screen-based programs on a remote machine, which can be very useful,

        e.g. when implementing menu services.  Multiple -t options force tty

        allocation, even if ssh has no local tty.


查看完整回答
反對 回復 2019-09-18
  • 3 回答
  • 0 關注
  • 1230 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號