Given the following table
$ connmanctl services
*AO MyNetwork wifi_dc85de828967_68756773616d_managed_psk
OtherNET wifi_dc85de828967_38303944616e69656c73_managed_psk
AnotherOne wifi_dc85de828967_3257495245363836_managed_wep
FourthNetwork wifi_dc85de828967_4d7572706879_managed_wep
AnOpenNetwork wifi_dc85de828967_4d6568657272696e_managed_none
I'd like to be able to connect to a network, e.g. OtherNET, using the string OtherNET rather than the long wifi_dc85de828967_38303944616e69656c73_managed_psk, as I don't want to count the times I press Tab and/or check that the wifi_ line in the prompt corresponds to the intended network.
Is this possible with connman only? Or do I really have to write a wrapper myself?
The man page of connmanctl contains
services Shows a list of all available services. This includes the nearby wifi networks, the wired ethernet connections, blue‐ tooth devices, etc. An asterisk in front of the service indicates that the service has been connected before.
and
connect service Connects to the given service. Some services need a so- called provisioning file in order to connect to them, see connman-service.config(5).
which both don't say much about the format of the output or the use of the command.
Similarly, the wiki on Arch Linux refers to the last column as the second field beginning with wifi_.
Since nobody has answered yet, I have found some spare time to code the following wrapper, which basically does the following
exit;connect, the following word is used to pattern-match one line (only the first matching line) fromconnman services; the last field of this line (the one which starts withwifi_) is forwarded toconnmanctl connect;connmanctlas it is.NOINPUTS_BEFORE_EXITwhose default is3) of empty inputs causes the script toexit.The script is the following
The script limitations are at least the following:
readlinelibrary, so line editing impossible.