Kenny McCormack <
gaz...@shell.xmission.com> wrote:
> >errors out in the second expression, [...]
>
> You have to do it step by step. For example, the following works for me:
>
> if $?TERM then
> if $TERM == "" then
> echo "TERM is set but empty"
> else
> echo "TERM is set to: $TERM"
> endif
> else
> echo "TERM is unset"
> endif
The problem is, this does not give you 'TERM is either unset, or empty'
in one branch.
For the background, the test is from csh.login where I want to run
tset(1) only if TERM is not sane, to avoid side-effects. Since I just
learned that "eval `tset -QIs ...`" will only produce a string, and not
re-initialize the terminal, I am now running tset unconditionally.
> >ObHint: " | sed '/csh.*harmful/d'"
>
> Well done!
From the grab bag of "The [t]csh user's hundred helpful sed one-liners"
[1] ;)
> But, yeah, the syntax of csh/tcsh is kinda creaky, but that's mainly because
> it hasn't been maintained (i.e., enhanced, built up, etc) in decades.
AFAIK csh has a handwritten parser, no defined grammar. Many things are
just as irregular as they are, take 'em or leave 'em.
Cheerio,
Hauke
[1] Also: <
https://meyerweb.com/eric/comment/chech.html>
--
Now without signature.