 |
 |
Shell Scripting?
|
 |
|
 |
|
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status:
Offline
|
|
Hi,
I wanted to make a little script so that when I type "seti" into the command line, it runs setiathome in a pre-specified folder. At the moment, I have in my .cshrc file:
alias set "cd ~/.setiathome && setiathome"
But this doesn't quite work. It still just runs setiathome in my home directory. Could somebody show me how to go about doing this? I'd like to learn as much as possible too. Thanks a bunch!
Gabe
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Nov 2000
Location: Kalamazoo, Michigan, USA
Status:
Offline
|
|
Originally posted by Zimwy:
<snip>
alias set "cd ~/.setiathome && setiathome"
But this doesn't quite work...
Perhaps you might want to try:
alias set "cd ~/.setiathome && ./setiathome"
If the present working diretory (here, setiathome) isn't in your path, it won't be able to run the program. There are good reasons for not putting the present working directory in your path, try searching google if you're curious about the debate.
|
 Charles
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status:
Offline
|
|
Two thoughts:
1) your example shows you aliasing 'set'. 'set' is a built-in shell command and it's not advisable to use this as an alias name.
2) create a shell script:
Code:
#! /bin/sh
cd ~/.setiathome
./setiathome
and save it as /usr/bin/seti, then chmod a+x /usr/bin/seti and you're all set.
|
|
Gods don't kill people - people with Gods kill people.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status:
Offline
|
|
Hey,
I actualled figured out the alias. I was just being stupid. I'd love to learn more about shell scripting though. Is there any place you guys can turn me to to learn? Thanks!
Gabe
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Nov 2000
Location: Kalamazoo, Michigan, USA
Status:
Offline
|
|
Originally posted by Zimwy:
I'd love to learn more about shell scripting though. Is there any place you guys can turn me to to learn?
Dæmon News, an online and print magazine, had a great introduction to the C shell last year. It starts off with the basics and discusses all sorts of nifty things you can do with csh and tcsh.
Part 1 - Part 2 - Part 3
Also, the original paper written by Bill Joy, author of the C shell, is available on the internet:
http://docs.freebsd.org/44doc/usd/04.csh/paper.html
(or, as a PDF with full glossary and appendix at http://docs.freebsd.org/44doc/usd/04.csh/paper.pdf)
I guess those are the two best resources I can think of off the top of my head on the internet. I hear O'Reilly's book Using csh & tcsh is also supposed to be a great reference.
|
 Charles
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status:
Offline
|
|
As many will tell you, it is generally considered a bit poor to use the c shell. This is because it isn't terribly consistent across platforms.
I typically use sh for simple scripting and if it is more complex use either TCL or Python. A lot of people swear by Perl as well.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|