From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13779 invoked by alias); 24 Apr 2013 19:51:15 -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: 17769 Received: (qmail 26097 invoked from network); 24 Apr 2013 19:51:13 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130424125052.ZM15513@torch.brasslantern.com> Date: Wed, 24 Apr 2013 12:50:52 -0700 In-reply-to: Comments: In reply to "TJ Luoma" "How should I construct this?" (Apr 24, 2:16pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "Zsh-Users List" Subject: Re: How should I construct this? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 24, 2:16pm, TJ Luoma wrote: } } 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 In addition to Thomas's hashtables remarks, zsh "for" also supports populating multiple variables each pass around the loop. So if you have an ordinary array like your example (BTW I hope those aren't your real passwords) then you can do for SSID WIFIPASS in $ALL_WIFI_NETWORKS do # Attempt to join network $SSID using $WIFIPASS done If you declare ALL_WIFI_NETWORKS as a hash table as Thomas suggested, then you can still do for SSID WIFIPASS in ${(kv)ALL_WIFI_NETWORKS} do # ... done but the SSID probably won't be in the same order as you assigned them, because hashes return their values in hash bucket order. If you need to preserve a fixed ordering, you have to use a real array.