Re: Beginners questions (tcsh) 1. set histdup 2. ??

From: Stephen Riehm (stephen.riehm_at_gmx.net)
Date: 10/15/04


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.

How?
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
minimal.

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.

Steve



Relevant Pages

  • Re: Set -o Vi Causes core dump and segmentation fault
    ... set -o vi command and nothing happened. ... After a day of divide and conquer on 18 scripts we have figured ... different from the parent shell's editor it causes this segmentation ... If you then spawn a ksh subshell,run set -o vi, ...
    (linux.redhat)
  • Re: vi horizontal split screen
    ... efficient at processing scripts, and one way to do that was substitute ... Microsoft's work for OLE in Windows 1x through 3x. ... As more and more users come to Linux who have no desire for command line ... effectively a programming environment. ...
    (comp.editors)
  • Re: Beginners questions (tcsh) 1. set histdup 2. ??
    ... >> learn two shells, one for interactive, and one for scripting. ... What do you do in your scripts which is the ... > SAME as what you do on the command line? ... > far more comfortable than those of zsh, bash or ksh. ...
    (comp.unix.shell)
  • Re: Cron to email notification of ftp file upload?
    ... or traceroute and getting "command not found" messages and then trying to ... >use sudo command when you need to make root privileged changes, ie, ... [ohmster@ohmster scripts]$ sudo crontab -l ... $ cat ftpwatch ...
    (alt.os.linux)
  • First skirmishes with Safe Tcl interps, pluginmgr, Tablelist and homespun package...
    ... I am trying to create a plugin environment for my application which ... will allow simple user written scripts to be run. ... the list command doesn't show plugins that are created using the ... Inside the slave I can package require "oow", ...
    (comp.lang.tcl)