1. Is there any standard directory for putting your own scripts?
The first directory listed in the PATH variable is probably the one you'll want to use (the directory may not exist and you may have to create it). Here is what my path variable looks like:
path (/Users/username/bin /usr/local/lib /usr/local/bin /usr/bin /bin /usr/local/sbin /usr/sbin /sbin /usr/lib /Developer/Tools .)
2. I put the command in .tschrc. Is this the appropriate startup file?
I don't use
tcsh shell and can never remember which of the two billion startup files it has is the appropriate one for what. You'll have to look at
man tcsh for that, or wait for someone else to answer the question.
3. I couldn't figure out how to append to the variable with the set command. How do you do this? (Everything works fine when I manually retype the entire current contents of path and then my additions.)
Well,
tcsh does it differently from
bash (my preferred shell) and i'm not sure of the exact syntax. Generally, it involves resetting the variable to a value which includes its old value, plus a new constant, such as
"${path} /Users/username/someOtherDir".
Alternatively, you could find which of the startup files defines the variable in the first place, and modify that (or copy it, or whatever).
Personally, i think you're better off not tweaking the variable if you can avoid it.
I already did this. What confused me was that the script worked fine if I typed the full path name, but if I was in the directory where the script was located, simply typing the script name did not execute the script. It turns out that the default value of path did not include "."
Of course another option is to create an alias which specifies the full path name. I'm
not recommending you do this, mind you, but it
is an option.
Personally, i think the
best solution is just to put your script in the first directory (which is in your user space) in the default setting of the
path variable (e.g.
/Users/username/bin). Again, you may have to create this directory.