no, it may not be portable among various *nix shells not among *nix OS variants . there are many differences what and how a shell is supporting. ash is a very lightweight shell, bash is not following the original unix features etc.
and by the way: first line makes $VARNAME to be $ID0 in ash.
you seem to be familiar with bash, then use bash: opkg update && opkg install bash. then set shebang to bash in your script.
my point was actually that if you want portable shell script you should forget bash-ism, like declare. but there are plenty of shells sh, csh, tcsh, zsh, bash, ash and many more, they are very different so I'd analyze your specific use case: if you can use bash on all your targets, let use bash. if you have mixed environment you either go to common minimum, or write your logic like first check shell then use shell specific code.
what @bkil suggested is a good solution by the way, and now you know that drawbacks of eval so you can prepare countermeasures.
No, I just can't find info relevant to ash used in the OpenWrt. I need minimal configuration possible and will not install anything just to be convenient. Target is default ash.
@bkil deleted his post. I did not see the suggestion!
What I desperately need right now is assigning variable pointed by another variable - as anything I find does not work in ash. While eval is evil I am ok to accept the risk right now.