From 2d424c63cbe04bf66e70ea43d9ae4b5ce715456b Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Sat, 28 Mar 2026 07:27:49 +0300 Subject: [PATCH] fix(netconf): accept interface number as input, not just name User sees a numbered list but could only type the name. Now numeric input is resolved to the interface name via awk NR==N. Co-Authored-By: Claude Sonnet 4.6 --- iso/overlay/usr/local/bin/netconf | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/iso/overlay/usr/local/bin/netconf b/iso/overlay/usr/local/bin/netconf index 63d2aff..277713e 100755 --- a/iso/overlay/usr/local/bin/netconf +++ b/iso/overlay/usr/local/bin/netconf @@ -13,11 +13,22 @@ for iface in $IFACES; do i=$((i+1)) done echo "" -printf "Interface name [or Enter to pick first]: " -read IFACE -if [ -z "$IFACE" ]; then +printf "Interface number or name [Enter = first]: " +read INPUT + +if [ -z "$INPUT" ]; then IFACE=$(echo "$IFACES" | head -1) +elif echo "$INPUT" | grep -qE '^[0-9]+$'; then + # Numeric input — resolve to name + IFACE=$(echo "$IFACES" | awk "NR==$INPUT") + if [ -z "$IFACE" ]; then + echo "Error: no interface with number $INPUT" + exit 1 + fi +else + IFACE="$INPUT" fi + echo "Selected: $IFACE" echo "" echo " 1) DHCP"