KcFnMi KcFnMi - 20 days ago 5
LaTeX Question

My Sublime Text Build System, run build.sh in current folder

Given the following scenario:

I'm editting

document.xyz
and in the same folder there is
build.sh
. I would like Sublime execute
build.sh
when hitting
Ctrl+B
.

The contents of
build.sh
are:

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


In other words, every time I hit
Ctrl+B
, no matter which document I'm editting, Sublime should print date to
date.txt
.

In order to do that I tried the following (saved it as My.sublime-build):

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


Which gives the error:

[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]


What am I doing wrong?

Answer

Please try this in your My.sublime-build:

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