On Tuesday 04 July 2006 12:57, yahav Biran wrote:
> Hi,
> Does any body know a good book with examples for learning tcsh. I would
> like to learn the benefits of using it by scripting such as: variables and
> arithmetic, looping, functions and other stuff.
>
To complement what other people said, let me give here a document I started
writing for trying to convince the Technion's EE department (my department),
but also the CS one to teach bash programming instead of csh programming:
<<<<<<<<<<<<<<<<<<<<<<
* Tom Christiansen's (The Perl World's No. 2 or 3 and one of the top UNIX and
Open Source Experts) Csh Considered Harmful:
- http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
* Bash has functions (as well as aliases) instead of just aliases, that are
easy to break.
* Bash has proper quoting.
- handling whitespaces in csh.
*
- Bash is the default scripting and login shell on Linux.
- ksh is the default login and scripting shell on non-GNU System V
systems.
- On Mac OS X, bash is the default scripting shell and I heard mixed
reports about whether it or tcsh is the default scripting shell.
- Only on the Open Source BSD variants, ash (a slightly enhanced Bourne
shell implementation) is the scripting shell and tcsh is the default.
- In all cases, c-shell is not used for scripting at all, only perhaps for
interactive use. And Bash/ksh/zsh is now often used for both.
- On cygwin the default shell is bash. zsh is available for either cygwin
or for non-cygwinned win32.
* Entire Bash mini-programs can be written, tested and debugged in one line.
This is impossible to do in csh which forces loops to be on separate lines.
* subshells and capture-subshells ($(...)) actually work in Bourne Shell.
- And Bash *has* capture-subshells which are much safer than `...`.
* The students tend to think that C-shell is "The UNIX Shell". Seeing how
lame C-shell is they tend to believe that the UNIX shell sucks. Which is not
the case for Bash and friends which are beautiful and a joy to work with.
* The wrong legacy reasons: many institutions once thought they had to make a
choice between sh (which had a sane syntax and programmability but bad for
interactive use) and tcsh which had bad programmability but with good
interactive capabilities. The Technion was one of the institutes that
standarised on tcsh.
For this generation the choice is clear: bash or zsh that combine both good
programmability and good interactive use. There's no reason to keep using
tcsh forever.
- csh->tcsh was a mistake. Bill Joy (and those that followed him on the
work on tcsh) should have created a Bourne Shell compatible shell with
many extensions, instead of creating a new shell that was so poor for
programmatic use. This is what ksh and bash did eventually, but with
some (sh-compatible) influence from csh.
People who may be able to help with the Conversion:
---------------------------------------------------
[SNIPPED because it may imply defamation]
>>>>>>>>>>>>>>>>>>>>>>
I should note that even if bash/zsh (and possibly also ksh) is more scalable
than tcsh, it still has many limitations and there are many things that
should better be done in $YOUR_FAVOURITE_P_LANGUAGE.
My shell history was that when I started to use Linux at home I it had bash
installed by default. Then at work at Cortext web design, I was instructed to
use tcsh. Back then I couldn't tell the difference between bash and tcsh, and
wrote most of my shell scripts in Perl, which was what I knew.
Afterwards, I took a bit of break from Unix, and then installed Linux on my
home machine, and again it came with bash. I gradually taught myself more and
more shell commands (but there's still a lot I don't know in bash). Then,
when I came to the Technion, I couldn't set bash as my login shell in t2, and
everyone were taught csh in courses (and I had many friends who studied Matam
or Mamat), and I kept finding tcsh to be incredibly lame and unforgiving,
both as a scripting shell, and as a user shell. (why *must* I type newlines
for loops?)
I kept evangelising bash and the other modern Bourne-shell-derived shells.
(which I don't know, but are also cool). Tcsh vs. Bash was discussed to death
in Hackers-IL ( http://www.hackers.org.il/ ) and the Haifa Linux Club mailing
list ( http://www.haifux.org/ ), ( partially because of me... ;-)).
I once asked one hacker who mentioned a new bash feature, if he converted from
tcsh to Bash. He told me "Yes. Never Looked Back.". I had to look a bit back
because I took Mamat in the Technion because it was an easy course for me and
gave me some good credit, and I was lucky not to become petrified like Lot's
wife.
Naturally, if you have scripts written in tcsh you should still learn it in
order to maintain them. (and hopefully eventually converting them to bash).
But there's no excuse in writing anything half-serious with it or using it as
a user shell anymore, or else you'll get bad practices.
Csh is Evil with one of these gigantic "E"'s you can find at the beginning of
chapters.
Regards,
Shlomi Fish
---------------------------------------------------------------------
Shlomi Fish [EMAIL PROTECTED]
Homepage: http://www.shlomifish.org/
95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]