Re: TCSH and me!



Michael Tosch <eedmit@xxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
Keith Thompson wrote:
[...]
Perhaps we could avoid having this argument.
bash is generally considered superior to tcsh for programming, but
tcsh does have some interactive features that bash lacks. There are
certainly advantages in using the same shell for programming and
interactive use. Personally, I use tcsh interactively, but I seldom
use csh or tcsh for scripts.

Examples, please!

I have a little exercise that proves that bash has better interactive
features.
[snip]

No, it merely demonstrates that some of bash's features are better
than some of tcsh's features. I argue that the reverse is also true.

tcsh's "bindkey" command, at least with the "-c" option, doesn't
correspond to any bash feature I'm aware of. It lets me type part of
a command line, interrupt it to execute a command in the current
shell, and then continue typing the original command.

For example:
bindkey -c ^G. 'echo -n "% " ; eval $< ; echo ""'
In the middle of a command, I can type "control-G '.'". I get a "% "
prompt where I can enter and execute a command in the context of the
current shell. When the sub-command completes, the original command I
was typing is still there. I find it very useful when I want to check
on something while composing a very long command line.

Similarly:
bindkey -c ^G^G 'dirs -v -l ; jobs -l'
gives me a quick idea of where I am and what I'm doing, and
bindkey ^Gw which-command
lets me see how the command I'm currently typing is going to be
resolved ("which-command" is a built-in tcsh editor command).

Another useful editor command is history-search-backward, bound by
default to M-p (or escape-p). I can type the beginning of a command
I've already typed and hit escape-p to recall the most recent command
that started with the same sequence of characters -- and the command
appears as if I had typed it, so I can edit it before running it
again.

I don't often use bash interactively, so it's possible I'm missing
some equivalent features.

Note that I am *not* arguing that tcsh is better than bash overall. I
use it as my interactive shell because my default shell was csh on the
first Unix system I used (about 25 years ago), and I'm accustomed to
it. If I were giving advice to a Unix beginner, I'd probably
recommend using bash both interactively and for scripting. And if a
future version of bash adopts some of tcsh's interactive features, I
just might switch.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages