Hello,
It seems there is a problem in the way the R48b deals with the
spaces in the variables. Below is a piece of code showing the strange
behaviour:
+-- debug.sh ----------------------------+
x="X 1"
y=" 1"
echo $#
shift ${x#X}
echo $#
shift $y
echo $#
[ 1 = 1 ] || echo "BUG the 1st!"
[ ${x#X} = $y ] || echo "BUG the 2nd!"
[ $y = ${x#X} ] || echo "BUG the 3rd!"
+----------------------------------------+
And here are the results you get running it with different shells:
seb) bash ./debug.sh a b c
3
2
1
seb) dash ./debug.sh a b c
3
2
1
seb) mksh ./debug.sh a b c
3
3
2
./debug.sh[9]: [: 1: unexpected operator/operand
BUG the 2nd!
./debug.sh[10]: [: 1: unexpected operator/operand
BUG the 3rd!
As you can see, despite there are no quote to surround the variables
anywhere, mksh sometimes keeps the leading space as a part of the
resulting arguments; I say "sometimes" because you can notice the
"$y" variable is standing correctly as a shift's argument but not in
the final test.
Take care,
Seb.