python文件 te.py import sys def m(): a=44 return a if __name__ == '__main__': b=m() sys.exit(b) shell文件 te.sh #!/bin/bash python te.py echo $? 这样就可以在shell里面调用python文件的返回值了