> 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
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
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
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
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 "
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
>
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