可以將目錄作為參數傳遞: import subprocessarg_directory = 'hello world'subprocess.call(['sh', './launchNastran.sh', arg_directory]) 然后在shell腳本中閱讀 /appli/nastran -msc20121 TRAM mem=512M buffsize=25601 batch=no CHEMIN="$1"\cp -rf TRAM MODELE ./*f06 ./*f04 ./*log ./*op2 ./*pch "$CHEMIN"