From: Roy Marples Date: Thu, 14 Aug 2008 12:14:23 +0000 (+0000) Subject: Don't quote for uniqify and use 1 sed call instead of looping. X-Git-Tag: v4.0.2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf05d568c4aa6d86e13ed5379dd5928cd5f726cc;p=thirdparty%2Fdhcpcd.git Don't quote for uniqify and use 1 sed call instead of looping. --- diff --git a/dhcpcd-hooks/20-resolv.conf b/dhcpcd-hooks/20-resolv.conf index 351430c0..f6fecff0 100644 --- a/dhcpcd-hooks/20-resolv.conf +++ b/dhcpcd-hooks/20-resolv.conf @@ -23,19 +23,13 @@ build_resolv_conf() done # Build a search list - for x in ${interfaces}; do - x="${resolvconf_dir}/${x}" - search="${search}${search:+ }$(sed -n 's/^search //p' "${x}")" - done - [ -n "${search}" ] && search="search $(uniqify "${search}")\n" + search=$(cd "${resolvconf_dir}"; sed -n 's/^search //p' ${interfaces}) + [ -n "${search}" ] && search="search $(uniqify ${search})\n" # Build a nameserver list - for x in ${interfaces}; do - x="${resolvconf_dir}/${x}" - srvs="${srvs}${srvs:+ }$(sed -n 's/^nameserver //p' "${x}")" - done + srvs=$(cd "${resolvconf_dir}"; sed -n 's/^nameserver //p' ${interfaces}) if [ -n "${srvs}" ]; then - for x in $(uniqify "${srvs}"); do + for x in $(uniqify ${srvs}); do servers="${servers}nameserver ${x}\n" done fi