Bash script programming Questions -

I want to mod the file in the source, the following is modded the wifi SSID sample:

uci -q batch <<-EOF
set wireless.${name}=wifi-device
set wireless.default_${name}.mode=ap
set wireless.default_${name}.ssid=OpenWrt-$(cat /sys/class/ieee80211/${dev}/macaddress|awk -F ":" '{print $5""$6 }'| tr a-z A-Z)
set wireless.default_${name}.encryption=none
uci -q commit wireless

Now, I have a new question about it, in about SSID part,
We could get OpenWrt-12AB, I could convert "12AB" to decimal value: "OpenWrt-4779" by $((0x12AB)).

If I need to add a fixed bias to the value, 4779+100 = 4879 for "OpenWrt-4879", how to do it? Thanks.

To get decimal value:
(the 0x prefix is required)
To add another decimal value to it:

Also a nitpick but while OpenWrt can run bash, the shell which you typically get pre-installed with it is ash, a much simpler, smaller and faster shell (the above syntax works in it, as well as in Bash).


All ok, many thanks.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.