Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Sep 2001 11:23:13 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        rene@xs4all.nl
Cc:        questions@freebsd.org
Subject:   Re: bash question
Message-ID:  <20010930112313.A92296@student.uu.se>
In-Reply-To: <20010930110919.A22614@xs4all.nl>
References:  <20010930110919.A22614@xs4all.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 30, 2001 at 11:09:19AM +0200, rene@xs4all.nl wrote:
> Hi. 
> 
> I know this is sort-of off-topic, I'd appreciate it if someone would email me
> a list of bash-related mailinglists.
> 
> But, my short bash question: 
> on http://www.linuxdoc.org/LDP/abs/html/othertypesv.html I read:
> 
> A script can export variables only to child processes, that is, only to
> commands or processes which that particular script initiates. A script
> invoked from the command line cannot export variables back to the command
> line environment.  
> 
> I want to change my prompt via a script, and that would require to export to
> the parent process, right... Is there any other way to do it?

(This applies equally to /bin/sh as to bash.)

The trick is to run the script within the existing process instead of
starting a new one.
To do this you invoke the script as:

. /path/to/myscript

instead of just

/path/to/myscript

Then the script will run in the current shell and you can change the
prompt via it.

(If you should use csh/tcsh instead of sh/bash/zsh the syntax is
slightly different: 'source /path/to/myscript' )


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010930112313.A92296>