[comp.unix.shell] csh & .login

breck@risky.ecs.umass.edu (Liam Breck) (04/07/91)

I've RTFM (and it is indeed a F awful M, grrrrr) to no avail...  Is it
possible to invoke (from a running sh or csh) a non-login csh that
sources .login and then prompts for input as always?  (Analagous to
bash -login.)

I'm sure this is a FAQ, but the existing FAQ list is too general.
Shouldn't we think about compiling a comp.unix.shell FAQ list,
separate from the general unix FAQ list?

thanx!
-- 
Liam Breck     breck@umvlsi.ecs.umass.edu

weimer@garden.ssd.kodak.com (Gary Weimer (253-7796)) (04/09/91)

In article <1890@umvlsi.ecs.umass.edu>, breck@risky.ecs.umass.edu (Liam
Breck) writes:
|> I've RTFM (and it is indeed a F awful M, grrrrr) to no avail...  Is it
|> possible to invoke (from a running sh or csh) a non-login csh that
|> sources .login and then prompts for input as always?  (Analagous to
|> bash -login.)

You need to call /bin/csh with a leading '-'. There are two ways to do
this. Both should work from sh and csh.

1) use links:
      % ln -s /bin/csh ~/bin/-csh
      % rehash                      #assuming ~/bin is in path
      % -csh
   NOTE: this will not work if run as ~/bin/-csh. It must start with '-'.

2) use execl(3V) in a C program:
      main() { execl("/bin/csh", "-/bin/csh", (char *) 0);}
   I prefer to do error checking, so I use:
      main()
      {
          execl("/bin/csh", "-/bin/csh", (char *) 0);
          perror("execl failed:");
          exit(1);
      }

in SunOS 4.1.1 on a sun4 under X11R4, I get:
    /dev/ttyp1: Not owner
but it is not a problem later, just an inconvenience.
      
weimer@ssd.kodak.com ( Gary Weimer )