csh weirdness (HELP!)

Ian! D. Allen [CGL] idallen at watcgl.waterloo.edu
Sun Aug 19 11:11:39 AEST 1990


I'm concerned about the number of people posting to the Wizards list
who should be posting to comp.unix.questions.  This is a Wizards list;
wading through rampant lack of Unix experience is tedious.

Someone is claming that CSH's "Ambiguous" error is due to different
handling of the built-in kill vs. /bin/kill.  I think not:

    % `echo date`
    Sat Aug 18 20:10:09 EDT 1990
    % `echo date foo`
    `echo date foo`: Ambiguous.

CSH is just stupid about the number of words that are allowed to
expand in a command name generated by back-quotes.  It only allows one
word, because it won't re-parse the line for arguments.  You get the
same error here:

    % date >`echo hi hi`
    `echo hi hi`: Ambiguous.

CSH expects single words in funny places, and that's the error you get
if you don't comply.  For more entertainment, a huge list of CSH
bugs (4.2BSD, but most still apply) is available via anonymous ftp
from watcgl.waterloo.edu as CSHbugs.Z (compressed).  A sample:

Subject: EVAL built-in mishandles and ignores pipes and redirection
    eval "who|sort"         # the |sort is ignored
    eval "who >x"           # the >x is ignored
    eval "who|date >x"      # the pipe is ignored; date goes in x
    eval "who|date >x;echo hi" >y
        # WHO goes to Y, DATE to X, and HI to tty (!)

Subject: CSH bug with TOSTOP set, using EVAL
    If you have STTY TOSTOP set, then
        % time eval date
    hangs forever, or until you kill it with SIGQUIT.

Subject: CSH loses memory when GLOB applied to external commands.
    Either of the following loops will use up all the memory on your computer.
     A: % while ( 1 )
        ? /bin/echo `date`
        ? end
     B: % while ( 1 )
        ? /bin/echo *
        ? end
    CSH does not free the GLOBbed list of words attached to an
    external command name; if one command is followed immediately by
    another GLOBbed command, the first GLOB list is not freed.

Subject: Expanding variable with newline generates syntax error
    % set x="abc\
    def"
    % echo "$x"
    Unmatched ".

Subject: Expanding quoted variable loses character before newline
    % set x="abc\
    def"
    % echo "$x:q"
    ab
    def

Subject: Quoting slash in a pathname fouls up GLOB
    % echo ."/"*
    echo: No match.
    % echo "$cwd/"*
    echo: No match.
    % set x=/
    % echo "$x"v*
    echo: No match.
    % echo "$x"/v*
    //vmunix

Subject: Quoting lost in repeated ECHO
    % repeat 3 echo "/genvmu*"
    /genvmu*
    /genvmunix
    /genvmunix

Subject: Can't redirect output of "source"
    % echo "date" >file
    % source file >output
    Thu Sep  3 17:47:19 EDT 1987

Etc, etc, etc...  I kludged away at all these bugs and managed to fix
them in a local version of 4.2BSD CSH, but the result was not pretty and
I still don't know why many of my fixes work.  If the FSF version of bash
only supported transitivity in aliases, I'd move to it in a flash.
-- 
-IAN! (Ian! D. Allen) idallen at watcgl.uwaterloo.ca idallen at watcgl.waterloo.edu
 [129.97.128.64]  Computer Graphics Lab/University of Waterloo/Ontario/Canada



More information about the Comp.unix.wizards mailing list