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 (LAN) IP
BIND=`getent hosts ${HOSTNAME} | awk '{print $1}'`

exec s6-setuidgid consul consul agent -config-dir /etc/consul.d/bootstrap
-bind ${BIND};

This is my execline script so far:

#!/usr/bin/execlineb -P

# load in the container environment
/usr/bin/s6-envdir -fn -- /var/run/s6/container_environment

importas -u HOSTNAME HOSTNAME
backtick -in BIND {
    pipeline { getent hosts ${HOSTNAME} }
    awk '{print $1}'
}
import -u BIND

It's dying at the awk line with:

awk: cmd. line:1: Unexpected token
withstdinas: fatal: child process exited non-zero

I know the getent hosts part works, because if I remove the awk line, the
BIND variable has the content I would expect.

Sorry for the noob question. But how can I pass the value to awk without it
complaining?

cheers,
Scott.

Reply via email to