env.d and tcsh
Kacper Kornet
kornet at camk.edu.pl
Sun Oct 17 16:15:04 CEST 2004
On Sat, Oct 16, 2004 at 03:16:47PM +0200, Paweł Gołaszewski wrote:
> On Fri, 15 Oct 2004, Kacper Kornet wrote:
> > > > Setting of variables from env.d does not work when tcsh is a login
> > > > shell. In csh.login is even a comment:
> > > > - set j = `grep -v "^#" $i |head -n 1`
> > > > - eval set "$j"
> > > > + set j = `grep -v "^#" $i |head -n 1|cut -s -d= -f1,2 --output-delimiter=' '`
> > > > + echo "$j"
> > > > + eval setenv "$j"
> > > Applied without one echo :) Did you tested it well?
> > Unfortunately not enough. I forgot about the possibility of "=" in the
> > value of variable. In that case it does'nt work.
>
> But works in other cases? If so - better than before :)
>
> Can you fix that?
OK, attempt no. 2:
#v+
--- csh.login.old 2004-10-17 15:59:12.000000000 +0200
+++ csh.login 2004-10-17 16:01:08.000000000 +0200
@@ -35,8 +35,9 @@
grep -v "^#" $i | head -n 1 > /dev/null
if ($status == 0) then
set backslash_quote
- set j = `grep -v "^#" $i |head -n 1|cut -s -d= -f1,2 --output-delimiter=' '`
- eval setenv "$j"
+ set j = `grep -v "^#" $i |head -n 1|cut -s -d= -f1 --output-delimiter=' '`
+ set j2 = `grep -v "^#" $i |head -n 1|cut -s -d= -f2-`
+ eval setenv "$j $j2"
# FIXME: how to retrieve something like $$NAME ??
# This is not working
#setenv $NAME "$NAME"
#v-
Now it works well for every file in my /etc/env.d.
Regards,
--
Kacper
More information about the pld-devel-en
mailing list