scripts

shell scripts
git clone git://git.bitsmanent.org/scripts
Log | Files | Refs | README

commit 35f2b9adf5e66e458ec42afd8081439dc962ca72
parent 21d3d94f4c2e13ea31561d4036e7fc1405858bdf
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Mon, 22 Apr 2024 09:52:13 +0200

Fix and simplify network selection.

Diffstat:
Msrc/iwpick | 15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/iwpick b/src/iwpick @@ -102,18 +102,15 @@ main() { echo "Looking for a suitable network... " net="$(pickone "$iface" "$file")" [ -z "$net" ] && die "no network found." - fi - - if [ -n "$net" ]; then - essid="$(echo $net |cut -d: -f2)" - key="$(echo $net |cut -sd: -f3)" - addr="$(echo $net |cut -sd: -f4)" - gw="$(echo $net |cut -sd: -f5)" else - # Check the networks file to get a key - key="$(sed -n "/:${essid}:/p" "$file" |cut -d: -f3)" + usage fi + essid="$(echo $net |cut -d: -f2)" + key="$(echo $net |cut -sd: -f3)" + addr="$(echo $net |cut -sd: -f4)" + gw="$(echo $net |cut -sd: -f5)" + echo "Connecting to ${essid}..." # If explicitly specified, check if the ESSID do exists