Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Andreas Schwab Newsgroups: gnu.bash.bug Subject: Re: PROMPT_COMMAND and PS1 error Date: Sun, 25 Oct 2015 22:59:39 +0100 Lines: 24 Approved: bug-bash@gnu.org Message-ID: References: <562CFEFE.7070306@me.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: usenet.stanford.edu 1445810391 28487 208.118.235.17 (25 Oct 2015 21:59:51 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Florian Mayer Envelope-to: bug-bash@gnu.org X-Virus-Scanned: amavisd-new at mnet-online.de X-Auth-Info: qnvlq6EoxoBy1mmQgkYDnkQs14Zm1OLrwAxI689KczmTmNgpVa5bqcHdo3Ryursy X-Yow: Hello. Just walk along and try NOT to think about your INTESTINES being almost FORTY YARDS LONG!! In-Reply-To: <562CFEFE.7070306@me.com> (Florian Mayer's message of "Sun, 25 Oct 2015 17:10:38 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:a60:0:28:0:1:25:1 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11762 Florian Mayer writes: > ==== file: first.sh ==== > . second.sh > > sl-get(){ > sl-set > sl-notify-change > echo $? > } > > sl-set-prompt(){ > PS1=$(sl-get)" >>" sl-get is executed in a subshell, and any effect on the state of the shell is forgotten after expansion. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."