Thank you for that. It tells me what is and isn't happening and gives me the proper way to do things - even though the incorrect way was working.
Thanks a bunch! Jeff On 2011-03-17, at 7:57 PM, Andre Nuno Soares wrote: > Hello Jeff, > > On Mar 17, 2011, at 4:42 PM, Jeff Berwick wrote: > (snip, snip) >> ()I was running my script with the following line: >> >> sh websites (websites being the filename) >> >> If I run it with the following command, it leaves me there when done: >> >> . websites (a dot before the name | websites still being the filename) > > The first way wasn't working because the directory change was being done in > the shell that you were invoking (the sh in the beginning of the line), not > the Terminal shell. Basically you were launching a program called sh and > telling it to run the series of commands in the file websites and then > terminate. > > The second way works but it also isn't running a script. In this case you are > telling the Terminal shell to execute the series of commands in the file > websites, which works for what you want, but doesn't run the script as a > separate process and also doesn't, for instance, allow using a different > shell in the script, like tcsh or even perl or python. > > To create a shell script, you must: > 1) Create a text file with the "hash bang" in the first line, like: > #!/bin/bash - note the exclamation mark (the bang) after the hash. Note also > there's no spaces > 2) Give the file execution permissions. > 3) To run it, place the file in a directory in your PATH environment > variable, or do something like: > ./websites > where ./ is interpreted by the shell as the current directory. If you had > placed the file in a directory called scripts in your home, you could do: > ~/scripts/websites > or > /Users/myuser/scripts/websites > > Hope my explanation wasn't too confusing :-) > > > HTH, > André >>> > > -- > You received this message because you are subscribed to the Google Groups > "MacVisionaries" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/macvisionaries?hl=en. > -- You received this message because you are subscribed to the Google Groups "MacVisionaries" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/macvisionaries?hl=en.
