Bash script programming Questions - mac80211.sh

I want to mod the file mac80211.sh 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
EOF
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:
$((0x12AB))
(the 0x prefix is required)
To add another decimal value to it:
$((0x12AB+100))

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).

4 Likes

All ok, many thanks.

1 Like

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