On 30/11/2015 06:57, Colin Booth wrote:
> I'm pretty sure that your single quotes are confusing the execline
> parser.
That's the answer. execline only uses double quotes, it does not
understand single quotes.
> Since awk accepts either single or double quotes as
> delimiters
Hm ? I don't think awk understand delimiters at all. It only
takes a single argument (in this case). The quotes are a shell
thing.
> define -sn B ${A} does essentially the same thing as awk '{print $1}'.
Not at all, if ${A} contains whitespace! ${B} will then expand to
several words, but you only want the first one.
I'd just do away with awk entirely and use cut instead:
-----
#!/usr/bin/execlineb -P
with-contenv
backtick -n BIND
{
pipeline { import -u HOSTNAME getent hosts ${HOSTNAME} }
cut -f1 -d" "
}
s6-setuidgid consul
consul agent
-config-dir /etc/consul.d/bootstrap
-bind ${BIND}
-----
which is pretty much the exact translation of the shell
script, but using cut instead of awk.
--
Laurent
Received on Mon Nov 30 2015 - 08:14:52 UTC