Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: IFS, set, and positional parameters not doing what I expect
- X-seq: zsh-users 7287
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: IFS, set, and positional parameters not doing what I expect
- Date: Mon, 29 Mar 2004 00:53:06 +0000
- In-reply-to: <20040328220419.21291.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040328220419.21291.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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