[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shell script question

"Han Huynh" <han_huynh@hotmail.com> writes:

> I know this isn't a bash/korn shell script news group, but the fact is
> I can't find one.  Since bash/ksh is the default linux shell, I was
> hoping  someone could answer a few pretty simple questions.
> Is there any way to export a variable for one parent shell to a
> different parent shell?  I know that export will work to a subshell,
> but I can't find any process to return a variable to a different
> parent shell.

Can't be done.  What are you really trying to do?  The "." command
will read in a child script in the current shell, so you can do things
like write a generic .variables script and then run
". $HOME/.variables" in both your shell startup file and your
.xsession to read those in.  Another useful alternative for really
short things is shell functions; I have some shell code that looks

  add() { if test -d "/mit/$1/arch/$ATHENA_SYS/bin"; then
          elif test -d "/mit/$1/bin"; then
          fi }

so I can run 'add outland' or whatever to add an MIT "locker" to my
shell path; there's an automounter running on /mit.

David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell

Reply to: