On 05 Aug 2011, at 16:32, Steven W. Orr wrote:
> On 8/5/2011 9:08 AM, Maarten Billemont wrote:
>>> IFS=
>>> aa=()
>>> while read line
>>> do
>>> aa+=("$line")
>>> done< fn
>>
>> You should really put that IFS= on your 'read', so as not to break the
>> default wordsplitting for the rest of you
On Fri, 5 Aug 2011, Steven W. Orr wrote:
One trick that bit me a while back, is that the order of declaring IFS and
old_IFS is important. It has to be done in this order:
foo()
{
typeset -r old_IFS="$IFS" # Must come first
typeset IFS
stuff...
}
I always use local and don't ch
On 8/5/2011 9:08 AM, Maarten Billemont wrote:
IFS=
aa=()
while read line
do
aa+=("$line")
done< fn
You should really put that IFS= on your 'read', so as not to break the default
wordsplitting for the rest of your script:
For purposes of giving concise examples on this email list, I wrote
> IFS=
> aa=()
> while read line
> do
> aa+=("$line")
> done < fn
You should really put that IFS= on your 'read', so as not to break the default
wordsplitting for the rest of your script:
while IFS= read -r line
> vs.
> IFS=$'\n'
> aa=($(< fn))
Don't leave expansions unquoted! you're still p