Sublime构建代码

时间:2016-04-29 15:28:25

标签: bash ubuntu sublimetext3

有人可以逐步解释以下构建脚本的工作原理吗?

{
"cmd": ["gnome-terminal -e 'bash -c \"python3 -i -u $file;bash\"'"],
"shell": true
}

我知道-i做了什么(保持解释器打开),最后bash保持终端打开,但其余部分对我来说是不可理解的。特别是-e-c-u做了什么,他们被称为“旗帜”,我在哪里可以了解更多关于它们的信息?哪些部分特定于Sublime,哪些部分与OS有关?

1 个答案:

答案 0 :(得分:1)

"gnome-terminal # use this terminal to run the next commands
  -e # execute the following command
   '
     bash -c # read commands from the following string 
       \"
          python3 
            -i # looks like interactive mode (sorry not a python dev)
            -u # force stdin, stdout and stderr to be totally unbuffered
            $file; # tipically this would be a python script, so you 
                   # would end up being able to inspect the environment,
                   # calling functions, seeing their otputs, etc 
          bash # open a new shell
       \"
   '
"

我认为可能属于Sublime的唯一部分是$file,但这取决于,在该代码上有更多的上下文,我可以给出更好的答案。