Thanks for the reply, but it is still not working. I have posted my location changer as you can see, and the plist is the exact one maxl posted but I changed the watched file to the one another poster said you needed to change it to in order for it to work on Yosemite. I have tried it with the original as well and still doesn't work. Also, still can't get an echo debug file to be written in any of the cases, so I think it has something to do with the shell script. Thanks.
The problem in your script is here (in a large font, in red):
Code:
case $SSID in
# Home network SSID
[SIZE="4"][COLOR="Red"]‘Alex’sNetwork’[/COLOR] )[/SIZE]
Those are curly quotes. The part in red needs to be changed to exactly this:
Code:
[SIZE="4"]"Alex'sNetwork"[/SIZE]
You should copy and paste that in, rather than typing it in.
I made it the same large font size as the one in red. You should be able to see slight differences in the quoting characters used. If not, zoom in with your browser.
There may be other problems. This is just the most obvious one, given what you've posted.
Exactly what editor are you using to edit this shell script?
If it's TextEdit, then you need to look in its Preferences window for "Smart Paste" and/or "Smart Quotes" and DISABLE those BEFORE pasting the above into the shell script.
After you save the file, close and reopen it. Then copy and paste the edited line into a reply here. If it still has curly quotes, we'll be able to see it.
When posting shell scripts, commands, and such,
please use code tags.
I think you might have to escape the ’ in your SSID name
'Alex\’sNetwork'
Backslash escapes don't work within single quotes (see 'man bash'):
Enclosing characters in single quotes preserves the literal value of
each character within the quotes. A single quote may not occur between
single quotes, even when preceded by a backslash.
If the quotes were all straight single-quotes, it would have to be this:
That is, you have to close the initial single-quoted part, escape a single single-quote, then make a final single-quoted part.
Since the text is completely literal (nothing that gets expanded between double quotes), the simplest and clearest thing to do
in this particular case is to enclose the apostrophe'd string in double quotes (as shown above). A completely generalized solution is more complex, and depends on the exact SSID of the network.
Shell quoting is more complicated than most people realize, even people familiar with shell quoting.