Re: Should dot command log me out? Excuse me if it is not a kernel question!

Michael H. Warfield (mhw@alcove.wittsend.com)
Tue, 28 Jul 1998 09:17:42 -0400 (EDT)


Frank Peng enscribed thusly:

> Appreciate your help:

> See this program named test.sh:

> #!/bin/sh
> echo $USER
> exit 0

> At the Linux prompt, type . test.sh
> It will logout out and ask my login in again.

Yup... That's correct...

> What I am doing is:

> I want to do something in a shell program like this:

> PATH=/tmp/bin:$PATH
> export PATH

> It never worked. I think this only send the variable to his child shell.
> But I want to send it to his sibling shell. So I type . test.sh

Take out the "exit 0" at the end. That's what's logging you out.
When you do ". test.sh" you are telling your current shell to "source" that
file and execute those commands. When you hit the exit command, your current
shell does exactly what it's told, it exits. :-)

Mike

-- 
 Michael H. Warfield    |  (770) 985-6132   |  mhw@WittsEnd.com
  (The Mad Wizard)      |  (770) 925-8248   |  http://www.wittsend.com/mhw/
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html