I am migrating some shell script from Unix to Linux and i am getting wrong value for integer variable.
In Unix:
integer X=007300
echo $X
7300
In Linux:
integer X=007300
echo $X
3776
Please help me why it is giving wrong output.
I am migrating some shell script from Unix to Linux and i am getting wrong value for integer variable.
In Unix:
integer X=007300
echo $X
7300
In Linux:
integer X=007300
echo $X
3776
Please help me why it is giving wrong output.
octal conversion taking place with the leading zeros.
~/$ printf "%o\n" 3776
7300
EDIT: It's happening in my workstation which uses ksh93 (Ubuntu) but not the ksh on my server, RHEL-4.8 pdksh-5.2.14-30.6
Perhaps installing pdksh if you are working under ksh93 would resolve
Confirmed (invoking pdksh on my workstation resolves the issue):
~/$ pdksh
$ integer x=007300
$ echo $x
7300