Is there a way to use the uci add_list ...
command without duplication if that option is already there? For example, I have a script with this command:
uci add_list firewall.@zone[1].network="wwan"
It works fine. But if I run the script a second time, I get TWO entries for wwan
. This doesn't hurt anything, but it seems wrong.
Is there a way to add it only once? Or a way to test for its presence and not add it a second time? Thanks.
Maybe something like that?
int="wwan"
if ! uci get firewall.@zone[1].network | grep "$int" >/dev/null; then
uci add_list firewall.@zone[1].network="$int"
fi
1 Like
That looks like it will do the trick. Thanks!
1 Like
It would probably be easier to first use a command that will simply delete the interface if it already exists (whether once or multiple times).
uci -q del_list firewall.@zone[1].network="wwan"
1 Like
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.