What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

helper/tool scripts

thesilence

New Around Here
Hi, my apologies if I'm in the wrong section. I'm wondering if there is a repository of helper scripts to parse common (or not so common) nvram settings and output them in an easy to parse way for larger scripts, or just for quick command-line reference? A quick search says no but I'm hopeful :) Assuming there isn't, here is my first jab at something useful (feel free to use/modify/throw out the window), or add your own to the thread if you like.

Code:
#!/bin/sh
# apg_info.sh
# print entry, index, bridge, vlan, vlan rule, enabled, ssid for each guest network
printf "Entry#\tIdx#\tBridge\tVLAN#\tVLANRul\tEnabled\tSSID\n"
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
  SSID=`nvram get apg$i'_'ssid`
  if [ "$SSID" != "" ]; then
    IDX=`nvram get apg$i'_'security|sed 's/^.*[^0-9]\([0-9]*\)$/\1/'`
    VL=`nvram get apg_br_info | tr '<' '\n' | awk -F'>' '{print $1 ":" $2}'|grep "$i:"|cut -f1 -d':'`
    BRG=`nvram get apg_br_info | tr '<' '\n' | awk -F'>' '{print $1 ":" $2}'|grep "$i:"|cut -f2 -d':'`
    EN=`nvram get apg$i'_'enable |sed 's/1/y/g; s/0/n/g'`
    VLR=`nvram get vlan_rl|tr '<' '\n'|awk -F'>' '{print $1 ":" $2}'|grep ":$VL"|cut -f1 -d':'`
    if [ "$VL" == "" ]; then VL="-";VLR="-";fi
    if [ "$BRG" == "" ] && [ "$EN" == "y" ]; then BRG="br0";fi
    printf "$i\t$IDX\t$BRG\t$VL\t$VLR\t$EN\t$SSID\n"
fi
done
 
Hi, my apologies if I'm in the wrong section. I'm wondering if there is a repository of helper scripts...
The tacked/sticked Asuswrt-Merlin Addon Software Catalog at the top of this subforum has a listing of the main scripts discussed in this subforum. Beyond that people sometimes post code to accomplish specific things to this subforum.
 
There's also some guides (and a few small code examples) on the asuswrt-merlin wiki that may help or give you some ideas
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top