Re: bug: return doesn't accept negative numbers

2011-08-05 Thread Linda Walsh
Linda Walsh wrote: Seem to fail on any negative number, but 'exit status' is defined as a short int -- not an unsigned value (i.e. -1 would return 255). Bob Proulx wrote: Eric Blake wrote: Linda Walsh wrote: I guess I don't use negative return codes that often in shell, but I use them a

Re: bug: return doesn't accept negative numbers

2011-08-05 Thread Dennis Williamson
return (and exit) returns an exit code between 0 and 255. Zero means true and anything else means false If you want a function to "return" a value, use printf or echo. On Fri, Aug 5, 2011 at 6:41 PM, Linda Walsh wrote: > > > > I guess I don't use negative return codes that often in shell, but >

Re: bug: return doesn't accept negative numbers

2011-08-05 Thread Bob Proulx
Eric Blake wrote: > Linda Walsh wrote: > >I guess I don't use negative return codes that often in shell, but > >I use them as exit codes reasonably often. For all of the reasons Eric mentioned you won't ever actually be able to see a negative result of an exit code however. > >'return' barfs on "

Re: bug: return doesn't accept negative numbers

2011-08-05 Thread Eric Blake
On 08/05/2011 05:41 PM, Linda Walsh wrote: I guess I don't use negative return codes that often in shell, but I use them as exit codes reasonably often. 'return' barfs on "return -1"... Since return is defined to take no options, and ONLY an integer, as the return code, it shouldn't be hard to

bug: return doesn't accept negative numbers

2011-08-05 Thread Linda Walsh
I guess I don't use negative return codes that often in shell, but I use them as exit codes reasonably often. 'return' barfs on "return -1"... Since return is defined to take no options, and ONLY an integer, as the return code, it shouldn't be hard to fix. Seem to fail on any negative number

Re: Another mapfile question.

2011-08-05 Thread Steven W. Orr
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

Re: Another mapfile question.

2011-08-05 Thread Maarten Billemont
> 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