Hi Joe,
Joseph J. VLcek wrote: > Great Jan! > > I have one comment below. > >> >>> >>> >>> usr/src/cmd/installadm/setup-sparc.sh >>> ------------------------------------------------------------- >>> >>> 97 dns_servers=`$GREP "$NAMESERVER_STRING" >>> $RESOLV_CONF_FILE 2>/dev/null | \ >>> 98 $AWK '{printf("%s ", $2)}'` >>> 99 dns_domain=`$GREP "$DOMAIN_STRING" $RESOLV_CONF_FILE >>> 2>/dev/null | \ >>> 100 $HEAD -1 | $AWK '{printf("%s", $2)}' >>> >>> This code could benefit from the ksh93 (/sbin/sh) built in extended >>> regular expression pattern matching. For examples see: >>> >>> http://installzone-wiki.central.sun.com/wiki/index.php/Ksh93_Tips#Use_built_in_extended_regular_expression_pattern_matching >>> >>> >> >> I am not sure if I could take advantage of this feature in this >> particular >> case, as I need to extract particular line from file, not only find >> the match. >> Could it be also used in such scenario ? > > > This would work but in this case I am not convinced it is actually > better than what you already have. > > $ > dn="" > > > $ > line="" > > > $ line=`$GREP "${DOMAIN_STRING}" ${RESOLV_CONF_FILE} > 2>/dev/null` $ if [[ "${line}" == > ~(E)^domain.* ]]; then ^Jdn="${line#domain }"^Jfi > $ echo > $dn > > > sfbay.sun.com > > So perhaps you should leave it as it is. Looking at the implementation, I concur with you that original version is better, as I think it is more readable. Thanks for digging into this ! Jan