Skip site navigation (1)Skip section navigation (2)
Date:      04 Feb 2002 16:06:32 +0000
From:      Wayne Pascoe <freebsd@molemanarmy.com>
To:        Ceri <setantae@submonkey.net>
Cc:        questions@FreeBSD.org
Subject:   Re: Stupid sh(1) question
Message-ID:  <m2ofj56xkn.fsf@set.ehsbrann.com>
In-Reply-To: <20020204154923.GA4312@rhadamanth>
References:  <20020204154923.GA4312@rhadamanth>

next in thread | previous in thread | raw e-mail | index | archive | help
Ceri <setantae@submonkey.net> writes:

> Not directly FreeBSD related, but a good one for Annelise's Linux->FreeBSD
> question archive.
> 
> I have a bash script that I wrote that does this :
> 
> 	SERVERS[0]="ns1.example.net"
> 	SERVERS[1]="doppler.example.net"
> 	[..]
> 	SERVERS[x]="mail.example.net"
> 
> and then later :
> 	for i in ${SERVERS[@]}
> 	do
> 	    stuff
> 	done | ${MAILCMD} -s "${SUBJECT}" ${RECIPIENT}

I would do something like the following

SERVERS="ns1.example.net doppler.example.net mail.example.net"
for i in $SERVERS; do
        echo $i;
done

Just separate each value with a space.

Hope that helps some ?  

-- 
- Wayne Pascoe
                                 | The time for action is passed.
freebsd@molemanarmy.com          | Now is the time for senseless 
http://www.molemanarmy.com       | bickering.
                                 | 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m2ofj56xkn.fsf>