$ setenv a "hi"
$ echo $a
hi
Similarly, when I do the below :
$ setenv b "hi" | grep "hi"
$ echo $b
b: Undefined variable.
Why is the setting lost?
My actual usage is source a.csh | grep "bla" ; echo $a (where $a is set in a.csh)
, but I thought the above is a simplistic case.
From the man page:
So the variable is set in a subshell only.