我有多个需要顺序执行的 python 代码。我是通过使用 abash 脚本来完成的。
#! /bin/sh
clear
echo "Test 1: Database Comparison"
python3 databasecomparison.py
python3 error.py
echo "Test 2: Conflicting ARFCNs"
python3 conflictingARFCNs.py
echo "Test 3: Conflicting Cell IDs"
python3 conflictingCID.py
echo "Test 4: Lonesome Location ID"
python3 conflictingLAC.py
echo "Test 5: Empty Neighbour List"
python3 neighbour.py
echo "Test 6: Missing IMSI"
python3 IMSI.py
echo "The tests are complete!"
notify-send "COMPLETED!"
现在,我的 error.py python 代码是
#!/usr/bin/env python3
import subprocess as s
file = open("doubt.txt","r")
Counter = 0
# Reading from file
Content = file.read()
CoList = Content.split("\n")
for i in CoList:
if i:
Counter += 1
#print("This is the number of lines in the file")
#print(Counter)
if Counter > 1:
print("There is some erroneous value. Please restart the scanner")
s.call(['notify-send','Alert!','There is some erroneous value. Please restart the scanner'])
我想将变量 Counter 的值从 python 代码传递到 bash 脚本,以便我可以执行:
if Counter > 1
then break
fi
但是,我无法传递变量 Counter。我在 stackoverflow 上查找了现有的解决方案,但说实话,我一直无法理解其中的任何一个。请帮忙。
繁星coding
开满天机
三国纷争
饮歌长啸
相关分类