shell script leading zero number error On Linux

https://stackoverflow.com/questions/12821715/convert-string-into-integer-in-bash-script-leading-zero-number-error

#test.sh

TEST1="08"
TEST2=09

test()
{
    echo $1 = ${1#0}
}

echo "TEST1=$TEST1"
echo ${TEST1#0}

echo "TEST2=$TEST2"
echo ${TEST2#0}

test 08
test 09

]$ ./test.sh
TEST1=08
8
TEST2=09
9
08 = 8
09 = 9
]$

: $((string))

덧글

댓글 입력 영역


통계 위젯 (화이트)

04
87
16442