Re: Beginners questions (tcsh) 1. set histdup 2. ??
From: Stephen Riehm (stephen.riehm_at_gmx.net)
Date: Fri, 15 Oct 2004 09:20:40 +0200
Bruce Barnett wrote:
> I use tcsh as well, but if you do this, you will eventually have to
> learn two shells, one for interactive, and one for scripting.
I don't see the problem.
What kind of bad habits? What do you do in your scripts which is the
SAME as what you do on the command line? They are two seperate subsets
of the shell's functionality (with a very small overlap!)
> This will make you confused, and may teach you bad habits.
> It's also harder, and will take longer.
You don't use the history in your scripts
you don't use command line editing in your scripts
on the other hand, learning how to write functions, trap signals and
work with arrays are the sort of things you're going to need in a lot of
scripts, but hardly ever on the command line.
> It's much better to use shells that are supersets of sh, like bash,
> zsh, ksh, etc.
Yes, but the reasons for that are for compatibility with existing sh
scripts. This has nothing to do with your command line interface!
In tcsh I use the history a lot, and command line editing.
There are a few programming constructs that I use occasionally on the
command line, like the odd for loop, but that's about all that you need
an interactive shell for. I never use 'if' on the command line.
Programming is a whole different matter. Complicated variable
substitution, while loops with if, then, else's and signal handling are
all things which you need in a program, but (normally!) won't be using
from the command line.
Like I said - two completely different ball games.
Perl is a great script language, and there are even people who have
written perl command line shells. Fantastic! And where are they? No-one
cares! Because the advantages of having perl as an interactive shell are
In the end, you are free to use whatever you like!
I find tcsh's command completion and history (quick tip: bind the
up/down keys to history-search-backward / history-search-forward) to be
far more comfortable than those of zsh, bash or ksh. It feels natural so
I use it. But I NEVER write programs in tcsh. Thats what perl, python or
ksh are there for.
And if you're worried about learning different command sets, how do you
cope with IDE's, editors (word processors), browsers, os's, or even
people? They all have different commands and behave differently. I just
find the "I use ksh on the command line BECAUSE I write my scripts in
ksh" argument completely bogus. The two activities have NOTHING to do
with each other.