On the topic of BASH loops
William Park
opengeometry-FFYn/CNdgSA at public.gmane.org
Thu Aug 19 17:30:00 UTC 2004
On Thu, Aug 19, 2004 at 11:14:59AM -0400, Paul King wrote:
> The recent discussion got me thinking about BASH loops. I use them ad nauseam
> to download radio programs of certain dates and times from radio station
> archives (such as Pacifica).
>
> The biggest issue for me was that if I had multiple dates, I could not place
> them in an array. For example:
>
> dates=("Mon Aug 16" "Tue Aug 17" "Wed Aug 18")
>
> for i in ${dates[@]} ; do
> echo ${i}
> done
Try
for i in "${date[@]}"; do
echo "${i}"
done
Without the double quote, shell is splitting the line on whitespace,
like
for i in Mon Aug 16 ...
--
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>
Open Geometry Consulting, Toronto, Canada
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list