found with coreutils-8.23, expr substr returns with an error code when the substring consists of only '0' characters, and the match is started at position 1.

$ expr substr 00001234 3 4; echo $?
0012
0
$ expr substr 1234 1 2; echo $?
12
0

$ expr substr 00001234 1 2; echo $?
00
1
$ expr substr 00001234 1 4; echo $?
0000
1
$ expr substr 00001234 1 5; echo $?
00001
0



Reply via email to