![](/img/trans.png)
[英]How can I call another python script, in a python script, based on a variable in a config file?
[英]How can I get the variable that a python file with a path prints when I call that python file from a shell script?
出於某種原因,當我在我的shell腳本中運行它時,只有$ exec_file和$ _dir被傳遞到module_test.py,但$ filename和$ modified_file都沒有通過。
mod_test=$( /path/module_test.py $modified_file $_dir $filename )
(路徑只是我為了這個例子而決定縮短的正常路徑)我輸錯了嗎? 我試圖將我的module_test.py的輸出(整數)放入變量mod_test。
我的變量是:
modified_file = _File
_dir = /path to directory/
file = _File.py
根據您的示例,您需要用引號括$_dir
,因為它包含空格,即:
mod_test=$( /path/module_test.py $modified_file '$_dir' $filename )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.