Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: IFS, set, and positional parameters not doing what I expect



On Mar 28,  3:04pm, jason@xxxxxxx wrote:
}
} f="a:b:c"
} OFS=$IFS; IFS=: ; set -- $f ; IFS=$OFS
} 
} which sets $1=a, $2=b, $3=c.

This requires either

	set -- ${=f}

Or that you have `setopt sh_word_split'.

} In zsh, this sets $1=a:b:c.  I've tried mucking around with
} the word splitting options to no avail.

Works For Me (tm):

schaefer<501> setopt shwordsplit 
schaefer<502> f="a:b:c"
schaefer<503> OFS=$IFS; IFS=: ; set -- $f ; IFS=$OFS
schaefer<504> echo $1
a
schaefer<505> echo $2
b
schaefer<506> echo $3
c



Messages sorted by: Reverse Date, Date, Thread, Author