在下面的代碼中,我構建了一個變量$ probe1,然後傳遞給bash腳本。我是下面的玩具示例,輸出是空白的,即$ probe1不能識別os.system調用中的bash shell腳本。需要做什麼?通過os.system將變量從python傳遞到bash shell腳本
for line1 in datfile:
datmat=datmat+[line1.rstrip('\n').split('\t')]
probe=datmat[i][0]
snp1=datmat[i][2]
probe1='permprobes'+probe+'pheno.pphe'
os.system('echo $probe1')
'PROBE1 =「...」'套一個Python變量。它與Bash無關。 – Blender
是否有某種方法可以將變量從python傳遞到bash shell?這基本上是我的問題。 – user1815498
你爲什麼需要這樣做? – Blender