Command Evaluation Using Backticks
Backticks can be used to store the result of commands:
localhost := `dumpinterfaces | cut -d: -f2 | sed 's/\/.*//' | sed 's/ //g'`
serve:
./serve {{localhost}} 8080
Indented backticks, delimited by three backticks, are de-indented in the same manner as indented strings:
# This backtick evaluates the command `echo foo\necho bar\n`, which produces the value `foo\nbar\n`.
stuff := ```
echo foo
echo bar
```
See the Strings section for details on unindenting.
Backticks may not start with #!
. This syntax is reserved for a future
upgrade.
The shell(…)
function provides a more general mechanism
to invoke external commands, including the ability to execute the contents of a
variable as a command, and to pass arguments to a command.