简体   繁体   English

从bash调用python脚本在命令提示符处停止

[英]Calling python script from bash stops at command prompt

I am calling a python script: 我正在调用python脚本:

/bin/sh
python ~/Documents/Projects/Programming/Python/svg/svg2dxf.py $1 0

After running the script, I get a python command prompt ($) and it's only when I type "exit" at the command prompt that the script runs. 运行脚本后,我得到一个python命令提示符($),只有当我在命令提示符处键入“ exit”时脚本才能运行。

What am I doing wrong? 我究竟做错了什么?

Change the following line: 更改以下行:

/bin/sh

with ( shebang interpreter directive ): 与( shebang解释器指令 ):

#!/bin/sh

Otherwise, the new shell instance is invoked; 否则,将调用新的shell实例。 until the new shell is exit, next line is not executed. 直到退出新的外壳程序,才执行下一行。

You should remove the leading: 您应该删除前导:

/bin/sh

Your current script does two things: 1) execute a new instance of /bin/sh ==> which gives your the shell $ sign 您当前的脚本有两件事:1)执行/ bin / sh ==>的新实例,该实例为您的shell $符号

2) execute the python script 2)执行python脚本

Your script should be: 您的脚本应为:

python ~/Documents/Projects/Programming/Python/svg/svg2dxf.py $1 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM