From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24072 invoked by alias); 24 Apr 2013 18:25:42 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17766 Received: (qmail 17841 invoked from network); 24 Apr 2013 18:25:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 66.111.4.221 is neither permitted nor denied by SPF record at _netblocks3.google.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type:content-transfer-encoding; s=smtpout; bh=QGMH4dBx2NGxfuINd8yvD3silF0=; b=K1+eOHaTyM2nkbEJQ2yK77/yLSOG yjhYVwSvgJdPxO5q5lnIXoZ7cjP/T7doFO9nccTDxwqZz1jfAT+eNUUKNWDgB+J7 4hTdi76pRMbyr/es3Pb5xor0LYUvp0/a7lCJbIXQjc7sZV2qOCSOBrwaLqhE1V8Y H2HOWxffzSHATrs= X-Sasl-enc: FM8ASgGB3ZsnPJO8/MOHBwjJ20/Ryhhq84btoNzbbz54 1366827387 From: "TJ Luoma" To: "Zsh-Users List" Subject: How should I construct this? Date: Wed, 24 Apr 2013 14:16:26 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate Trial (1.5.4r3323) I am trying to write a shell script which will help my computer automatically join Wi-Fi networks. Each network needs to have an SSID (which may have spaces in it) and a password (which may have spaces, punctuation, etc in it). I'm trying to figure out the best way to create this. I thought about trying to make an array or something like this where the first 'column' would be the SSID and the 2nd column would be the passwords ALL_WIFI_NETWORKS=( Home 89382ashfa Work 0823u2j98dyumn "Coffee House" "" "Jenny's Wifi" 8675309 ) but then I need to be able to loop through $ALL_WIFI_NETWORKS using only first column… something like this for SSID in {{{The First Arg in Each Line of $ALL_WIFI_NETWORKS}}} do echo "foo" done where the part in {{{ and }}} indicates the part where I really don't know how to do what I want to do. It seems like there's got to be an easier / better way of doing this, but I can't figure out what it is, other than keeping two lists/arrays, one of the SSIDs, and one with the passwords, but that seems kludgey because I have to ask the user (whoever uses this script besides me) to put the SSIDs in twice. TjL