[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug?
According to the man page, return should have the following behaviour:
return value
Causes the current function to exit, with value as the return
value (exit status).
However, given the following script:
#!/bin/es
fn test_fn {
for ( number = $x ) {
echo Number $number
while { ! ~ $#y 0 } {
echo Letter $y(1)
return 0
}
}
return 0
}
x = ( 1 2 3 )
y = ( a b c )
echo 'Results of function test_fn:' <={test_fn}
You would expect the output to be:
; test_fn
Number 1
Letter a
Results of function test_fn: 0
However, I get:
; test_fn
Number 1
Letter a
Number 2
Letter a
Number 3
Letter a
Results of function test_fn: 0
Has anyone run into this before? This only seems to be an artifact of using a
while; it doesn't happen if I replace the while statement with a for. Any
ideas?
Oh, I am using es-0.84 on a HP-755 running HP-UX 9.0.5.
-scott
--
_/ _/ _/_/_/ _/_/_/_/ _/_/_/ Scott C. Gray (gray@nas.nasa.gov)
_/_/ _/ _/ _/ _/_/ _/ _/ NASA Ames Research M/S 258-6
_/ _/_/ _/_/_/_/ _/_/ _/_/_/_/ For PGP public key, send me mail
_/ _/ _/ _/ _/_/_/_/ _/ _/ with subject line of "PGP request".