I have script as below:
in my file "list" only one record and there is no this file in current dir.
when running debug, I got below:
for the value of $flag, it should be 0, but it return 1 in my current script.
Is this because the while loop has one more read (see highlighted in blue) which causes the variable has no value been assigned, so it pick up ini value?
any body can help this
At first glance, the reversion in $flag's value suggests that the inner while-loop is running in a subshell environment, but that shouldn't be the case.
Exactly which shell version and operating system is this script run on?
At first glance, the reversion in $flag's value suggests that the inner while-loop is running in a subshell environment, but that shouldn't be the case.
Exactly which shell version and operating system is this script run on?
Can you be more specific regarding the source of the problem and the solution? As it stands, your last post would not be of any help to someone else confronted with the same problem. And, personally, I'm curious how that while-loop landed in a subshell (if that is indeed what happened).
Can you be more specific regarding the source of the problem and the solution? As it stands, your last post would not be of any help to someone else confronted with the same problem. And, personally, I'm curious how that while-loop landed in a subshell (if that is indeed what happened).
Regards,
Alister
to be honest, I don't know why.
when I first run the script I use:
sh scriptname
it gave me error.
when using ksh scriptname
I got correct result
Would you please explain what is different sh xxx and ksh xxx.