I'm looking through this shell script and I'm curious what the double curly braces are doing in this line:
https://github.com/jpetazzo/nsenter/blob/master/docker-enter#L16
I know that curly braces in shell are used for grouping, but what does two sets of curly braces do? If someone could explain this:
docker inspect --format "{{.State.Pid}}"
I would really appreciate it.
The context of this was a command running
docker inspect --format "{{.State.Pid}}"
The Docker option --format
takes a go template. Double-curly-braces are meaningful in Go templates, not in bash.
See the Go text.template package documentation for details. To quote from same:
"Actions"--data evaluations or control structures--are delimited by "{{" and "}}"; all text outside actions is copied to the output unchanged.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With