From owner-freebsd-questions Sun Sep 30 2:27:22 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mailb.telia.com (mailb.telia.com [194.22.194.6]) by hub.freebsd.org (Postfix) with ESMTP id 98C6037B40D for ; Sun, 30 Sep 2001 02:23:17 -0700 (PDT) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by mailb.telia.com (8.11.6/8.11.6) with ESMTP id f8U9NGt19927 for ; Sun, 30 Sep 2001 11:23:16 +0200 (CEST) Received: from ertr1013.student.uu.se (h185n2fls20o913.telia.com [212.181.163.185]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id LAA25919 for ; Sun, 30 Sep 2001 11:23:15 +0200 (CEST) Received: (qmail 96957 invoked by uid 1001); 30 Sep 2001 09:23:14 -0000 Date: Sun, 30 Sep 2001 11:23:13 +0200 From: Erik Trulsson To: rene@xs4all.nl Cc: questions@freebsd.org Subject: Re: bash question Message-ID: <20010930112313.A92296@student.uu.se> Mail-Followup-To: rene@xs4all.nl, questions@freebsd.org References: <20010930110919.A22614@xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010930110919.A22614@xs4all.nl> User-Agent: Mutt/1.3.22.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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' ) -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message