Csh setenv and `` don't like each other!

Derek R. Foster dfoster at jarthur.Claremont.EDU
Wed Apr 17 10:27:13 AEST 1991


AAAAAAAAAAAAAAAAAAAUUUUUUUUUUUUUUGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHH!!!!!!!!!!!

Consider the following:

> alias test 'echo "Test OK"'  <- Define an alias...
> test                         <- It works correctly
TEST OK
> echo `test`                  <- Even in backquotes
TEST OK

> setenv A `test`              <- But not after setenv. WHY?
`test`: Ambiguous              <- What on earth does "Ambiguous" mean here?
                               <- (Why on earth do UNIX system programmers
                               <- fear self-explanatory error messages so
                               <- much?)

> cat > testx                  <- make a file called testx
echo "abc def"
EOF

>source testx                  <- it works as expected
abc def

> setenv A "`source ./testx`"  <- even in the setenv with backquotes
> printenv A
abc def

                               <- but for another file....
> echo "`source /hmc2/hmc_1993/dfoster/project2/host_supports`"
 jove vi tex  msg

                               <- it breaks, and the program is never run.
> setenv A "`source /hmc2/hmc_1993/dfoster/project2/host_supports`"
`source /hmc2/hmc_1993/dfoster/project2/host_supports`: Ambiguous.

If anyone can shed some light on this behavior, I would be very happy.
All I want to do is set an environment variable to the output of a shell
script run via 'source', yet with every possible permutation I've tried with
all kinds of combinations of ', `, ", and \ placed in interesting places,
I have still consistently received the same bizarre results.
WHY??????

Derek Riippa Foster



More information about the Comp.unix.shell mailing list