我的Sublime文本构建系统,在当前文件夹

时间:2016-11-18 01:00:16

标签: c macos latex sublimetext3 sublimetext

鉴于以下情况:

我正在编辑document.xyz,并且在同一个文件夹中有build.sh。我希望Sublime在点击build.sh时执行Ctrl+B

build.sh的内容是:

#!/bin/sh
date >> date.txt 

换句话说,每当我点击Ctrl+B时,无论我编辑哪个文档,Sublime都应将日期打印到date.txt

为了做到这一点,我尝试了以下(将其保存为My.sublime-build):

{
    "working_dir": "$file_path",
    "cmd": ["sh","$file_path/build.sh"],
}

出现错误:

[Errno 24] Too many open files
[cmd: ['sh', '/Users/user/Downloads/test/build.sh']]
[dir: /Users/user/Downloads/test]
[path: /Users/user/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin]
[Finished]

我做错了什么?

1 个答案:

答案 0 :(得分:0)

请在你的My.sublime-build中试试这个:

{
   "cmd": ["bash","~/<filepath>/build.sh"],
   "selector": "source.shell",
   "shell" : "bash",
   "path": "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
}