无需引入单独的shell和python脚本,单个文件可以兼而有之!
用以下顺序替换您的shebang行:
#!/bin/sh# Shell commands follow# Next line is bilingual: it starts a comment in Python, and is a no-op in shell""":"# Find a suitable python interpreter (adapt for your specific needs) for cmd in python3.5 python3 /opt/myspecialpython/bin/python3.5.99 ; do command -v > /dev/null $cmd && exec $cmd "$@"doneecho "OMG Python not found, exiting!!!!!11!!eleven" >2exit 2":"""# Previous line is bilingual: it ends a comment in Python, and is a no-op in shell# Shell commands end here# Python script follows (example commands shown)import sysprint ("running Python!")print (sys.argv)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)