zsh-users
 help / color / mirror / code / Atom feed
* How should I construct this?
@ 2013-04-24 18:16 TJ Luoma
  2013-04-24 18:39 ` thomasg
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: TJ Luoma @ 2013-04-24 18:16 UTC (permalink / raw)
  To: Zsh-Users List


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-04-25  1:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-24 18:16 How should I construct this? TJ Luoma
2013-04-24 18:39 ` thomasg
2013-04-24 18:56   ` TJ Luoma
2013-04-24 19:53     ` thomasg
2013-04-24 19:08   ` peter.d.miller
2013-04-24 18:49 ` Paul Hoffman
2013-04-24 19:50 ` Bart Schaefer
2013-04-24 22:30   ` TJ Luoma
2013-04-24 22:40   ` TJ Luoma
2013-04-25  1:29     ` Paul Hoffman

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).