问题
The Short
This deals with SciTE and the go language in Windows (in particular, Windows 7). This is my first time using SciTE, so if there is another way to achieve my goal that is fine as well.
Goal: With one key press, compile, link, and execute the newly created binary.
The Long
I want to setup the compile/link/excecute under the "go" command in SciTE. This may be slightly confusing as it is also for the go language. Here is what I have so far:
command.compile.*.go=8g $(FileNameExt)
command.build.*.go=8l -o $(FileName).exe $(FileName).8
command.go.*.go=$(FileName).exe
What I would like is to have something like:
command.go.*.go=\
8g $(FileNamExt)\
8l -o $(FileName).exe $(FileName).8\
$(FileName).exe
If this worked the way I intended it would compile the file, link it, and then run the executable. What happens is:
8g hello.go8l -o hello.exe hello.8hello.exe
When it should be:
8g hello.go
8l -o hello.exe hello.8
hello.exe
Where each line is executed.
回答1:
Write a batch script like so:
@echo off
if (%1 == "") (goto end)
set gofile=%1%
shift
8g %gofile%.go
8l -o %gofile%.exe %gofile%.8
%gofile%.exe
:end
The batch file can be anywhere, but let's say it's in 'C:\one\two\three\GO.bat' sans the quotes. In the SciTE property file change:
command.go.*.go=$(FileName).exe
to
command.go.*.go=C:\one\two\three\GO.bat $(FileName)
And when you hit F5 or click on "Go", it will compile, link, and execute the file.
回答2:
You have line continuation escapes with no spaces which is why it looks like that.
I don't know Windows, but in unix shells you can separate multiple commands with semicolons (or &&
as peterSO mentions, which is more appropriate here).
You can still wrap, but realize that it's not going to consider the wrapping syntactically significant due, so add separation characters as appropriate.
来源:https://stackoverflow.com/questions/4503972/multiline-command-go-in-scite