[ale] Thanks - and another Bash script question

Danny Cox danscox at mindspring.com
Thu May 15 14:33:27 EDT 2003


Bob,

On Thu, 2003-05-15 at 12:06, Bob Kruger wrote:
> Some of the fields that I want to capture will have spaces in them, so I can't go that way.
> 
> I should have given a better example:
> 
> ct=(chevelle,two tone,green and white,two door)
> 
> where $ct[1] = chevelle , $ct[2]="two tone", $ct[3] = "green and white" , etc.

	You'll have to change (temporarilly) the Input Field Seperator, IFS. 
It's also tricky.  I had to resort to some old memories:

	OIFS="$IFS"
	ct='chevlle,two tone,green and white,two door'
	IFS=','
	set -- $ct
	IFS="$OIFS"

at this point, $1 has "chevelle", $2 has "two tone", etc.  You may be
able to shove that into an array (I've been singularly unsecessful), but
you can access the various members via "${!$n}".

	Mind the quoting also, it's tricky.
	
-- 
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.

Danny

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list