Now works for any number 01-99 in both bash and busybox sh.

$[] is a bashism and does not work on POSIX shells.
Links numbered 91-99 created a single digit link.
Links numbered 08 and 09 gave the error:
'bash: 100-08: value too great for base (error token is "08")'

Signed-off-by: Einar Gunnarsson <[email protected]>
---
 update-rc.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/update-rc.d b/update-rc.d
index c9355d7..95d1c22 100644
--- a/update-rc.d
+++ b/update-rc.d
@@ -114,7 +114,7 @@ renamelink()
         # or stop link to start link with a sequence number equal to the 
difference of 100 minus the original sequence number.
        if ls ${etcd}${lev}.d/${oldstartstop}*${bn} >/dev/null 2>&1; then
                oldnn=`basename ${etcd}${lev}.d/${oldstartstop}*${bn}|cut -c2-3`
-               newnn=$[100-$oldnn]
+               newnn=$(printf "%02d" $((100-${oldnn#0})))
                [ $verbose -eq 1 ] && echo "rename 
${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} -> 
${etcd}${lev}.d/${newstartstop}${newnn}${bn}"
                if [ $notreally -eq 0 ];then
                        mv ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} 
${etcd}${lev}.d/${newstartstop}${newnn}${bn}
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#153509): 
https://lists.openembedded.org/g/openembedded-core/message/153509
Mute This Topic: https://lists.openembedded.org/mt/83962162/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to