簡體   English   中英

將鍵盤命令編碼到Bash腳本中

[英]Encoding Keyboard Command Onto Bash Script

我可以通過以下方式使用qsub提交具有群集的作業:

 Submitting jobs from standard input
       To submit a PBS job by typing job specifications at the command line, the user types

              qsub [options] <return>

       then types any directives, then any tasks, followed by

              (in UNIX)     CTRL-D on a line by itself
              (in Windows)  CTRL-Z <return>

       to terminate the input.

有沒有一種方法可以在bash腳本中對RETURN和CTRL-D進行編碼,以便我們可以執行以下操作:

for i in path/*.txt; do echo "$i";  qsub [RETURN] /path2/mycode $i; [CTRL-D]; done

您應該通過管道使用重定向:

for i in path/*.txt; do
  echo "$i";
  echo "/path2/mycode $i" | qsub;
done

嘗試echo /path2/mycode $i | qsub echo /path2/mycode $i | qsub

如果這行不通,或者您需要傳遞更復雜的數據,那么期望可能會有所幫助。

只是為了澄清(因為烏鴉座的答案是正確的)-CTRL-D僅表示“文件結尾”或“輸入結尾”,因此當您將文本回顯到qsub時,它將自動發送文件結尾信號之后(與按CTRL-D相同)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM