Arnout Vandecappelle wrote:
  I guess you have a 'set -e' somewhere in your script?

  let returns the value it computed, so if $foo is different from 0, it will
return non-0. This causes the shell to exit.

  It's POSIX behaviour.
Bash "let" returns 1 if there is a sytax error within the expression or the expression is zero, 0 otherwise. So it is basically a "not" operator, the opposite of what you describe. I'm not sure there is a good reason for "let" to return an exit status depending on the value assigned, whether 0 is returned for a zero or a non-zero value assigned.

But bash does exit when let returns 1 and "-e" is set, so that might be the reason.

Regarding POSIX behaviour, the list of shell built-ins at http://pubs.opengroup.org/onlinepubs/007904875/idx/sbi.html doesn't even mention "let", and "let" can only implemented as a built-in as it must assign a value to a shell variable.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to