我有以下的Perl腳本(儘管這適用於Python和其他腳本語言):script1.pl
,script2.pl
,script3.pl
在不重寫Python/Perl腳本的情況下,我將如何將輸出一起輸出到bash腳本中?
這些腳本是書面的方式,用戶輸入的標誌執行它們,並且輸出保存的文件。
perl script1.pl --i input1.tsv ## this outputs the file `outputs1`
perl script2.pl --i outputs1 ## this outputs the file `outputs2`
perl script3.pl --i outputs2 ## this outputs the file `final_output`
(對於Pythonistas,這是python script1.py
)
現在,我想創建一個可執行bash腳本,讓用戶只需用input1
工作,並得到輸出的回報final_output
。
這是我怎麼會只有一個perl腳本爲此,execute.sh
:
#!/bin/sh
source ~/.bash_profile
FLAG1="--i=$1"
perl script1.pl $FLAG1
它可以在命令行execute.sh input1.tsv
與三個腳本運行在我的例子中,我如何管中間輸出到中間腳本中以創建一個execute.sh
腳本,例如outputs1
分成script2.pl
,然後outputs2
分成scripts3.pl
等?
有沒有一種方法可以讓我在不重寫perl/python腳本的情況下執行此操作?
編輯:其他信息:問題是我其實不知道輸出是什麼。文件名稱根據原始的inputs1.tsv進行更改。現在,我確實知道輸出的文件擴展名。但是outputs1和outputs2具有相同的文件擴展名。
通過調用具有正確文件名的腳本,與手動執行腳本相同,除了它在腳本中。沒有神奇的東西。 – hobbs
腳本是否需要特定的輸入/輸出文件?通常情況下,您只需將它們組合爲' outputs2'(並編寫腳本,當然可以) –
Ryan
如果腳本始終輸出爲硬連接的文件名,則除了更改腳本之外別無它法。 – choroba