Re: Rewriting a shell script

2015-11-30 Thread Laurent Bercot
On 30/11/2015 17:57, Colin Booth wrote: Eh what? define -sn splits ${A} into N words, of which the first is put into ${B} and the rest dropped.i Nope. It will split ${A} into N words, drop the last word if ${A} isn't terminated with a delimiter, and put all those words into B. Actually, on

Re: Rewriting a shell script

2015-11-30 Thread Colin Booth
On Mon, Nov 30, 2015 at 12:14 AM, Laurent Bercot wrote: > 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. > Delimiters was the wrong word. I was poorly trying to say that it wanted its script as a single elemen

Re: Rewriting a shell script

2015-11-30 Thread Scott Mebberson
Thanks guys! That really helped a lot. I tried define and couldn't get it to work, so I settled with awk, but I'll take a look at and try out cut instead. I like the simple `with-contenv` to import the environment. Nice and clean. Thanks again! cheers, Scott. On Mon, Nov 30, 2015 at 6:47 PM, La

Re: Rewriting a shell script

2015-11-30 Thread Laurent Bercot
And of course, one second after hitting "Send", I find a mistake. Poster's curse. #!/usr/bin/execlineb -P with-contenv backtick -n BIND { pipeline { import -u HOSTNAME getent hosts ${HOSTNAME} } cut -f1 -d" " } s6-setuidgid consul import -u BIND # forgot this one (backtick doesn't subst

Re: Rewriting a shell script

2015-11-30 Thread Laurent Bercot
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

Re: Rewriting a shell script

2015-11-29 Thread Colin Booth
On Sun, Nov 29, 2015 at 5:04 PM, Scott Mebberson wrote: > > Sorry for the noob question. But how can I pass the value to awk without it > complaining? > Hi Scott, I'm pretty sure that your single quotes are confusing the execline parser. Since awk accepts either single or double quotes as delimit

Rewriting a shell script

2015-11-29 Thread Scott Mebberson
Hi, I'm rewriting a shell script into execline, and I'm running into a few issues. I've used execline before, but not very much. I'm not that skilled at bash either. This script (runs within the s6-overlay environment): #!/usr/bin/with-contenv sh # Bind to the external (