@CAP-33 ya, so you're on the the new wifi config syntax as well as on the new wifi warp core.
The warp core works differently than the previous wifi, and actually does what you're looking for, if I've understood your posts correctly.

An Omega with warp core works more like how your laptop or smartphone work with wifi networks:

stores configuration data for networks you've previously configured

attempts to automatically connect to configured networks that are in range

@Lazar-Demin
When I upgraded the firmware I encountered some problems. I had to reset the firmware to the factory settings and set everything up again. And finally, I updated my Omega to the latest version, as described in the link left by you, but still the code written above does not work for me.

@CAP-33
It looks like your script is meant for a system that must be explicitly told which network to connect to. You don't need to worry about that on the Omega.
As I mentioned above, in the new firmware (b176 and up) the wifi driver actually automatically does what you're trying to do with a script.

It stores configuration data for networks you've previously configured, and automatically connects to available networks. If there's multiple configured networks in range, it will connect to the network that is listed higher in the /etc/config/wireless configuration file. So the list of configured networks works like a preference list (kind of like how Mac OS does their Wifi networking).

If you want to manually trigger a network reconnect, just run the wifi command.