我在寻找mac下能让Sublime通过Build System打开iTerm2编译C语言程序的方法.
之前在知乎找到的类似解决办法是这样的:
{
"cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && osascript -e 'tell application \"Terminal\" to activate do script \"clear&&${file_path}/${file_base_name} && read -p \\\"Press Enter to exit.\\\"&&exit\"'"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}
确实可行, 但是调用的是Terminal.
请问如果想调用iTerm2该如何实现呢? iTerm2文档中的scripting实在不知该如何运用在这里, 尝试改了无数次cmd
还是没有成功.