1848939 Members
7945 Online
104039 Solutions
New Discussion

Re: let under kornshell

 
Harris Chandra
New Member

let under kornshell

Does anybody know why the command line herebelow sends a SIGERR under HPUX/9000 kornshell ?

let k=1-1

example:
--------
#!/bin/ksh
trap 'echo SIGERR detected $?' ERR
let k=2-1
let k=1-1
let k=1-2
Move !
2 REPLIES 2
RikTytgat
Honored Contributor

Re: let under kornshell

Hi,

Because (extract from linux ksh manpage):

let [expression ...]
Each expression is evaluated, see Arithmetic Expressions above. If all expressions are successfully evaluated, the exit status is 0 (1) if the last expression evaluated to non-zero (zero).

So, exit status is 1 when result is 0, and since 1-1 equals 0 ...


Hope this helps,
Rik.
Harris Chandra
New Member

Re: let under kornshell

I still don't understand why it should send a SIGERR. One minus one or two minus two is clearly zero without error, and no one makes any mistake.
Unix is very bizarre, no wonder why Windows NT with its Visual Basic is progressing.
Move !