我想用python来运行以下bash脚本。
sed -n -e '/SCN/,/^\s*$/p' $@ > Junction-Links.txt
bash脚本被保存为ext-jun-links.sh,我想用Python运行它,用文件名代替$@。
我目前正试图使用下面的代码来做这件事。
import subprocess
from subprocess import call
subprocess.run(["./ext-jun-links.sh","NETL1405.TXT"], shell=True)
However, this gives me the error below:
'ext-jun-links.sh' is not recognized as an internal or external command, operable program or batch file.
有什么方法可以解决这个错误吗?在使用PowerShell和以下代码时,bash文件运行正常,所以这不是问题。
bash ext-jun-links.sh 'NETL1405.TXT'