bug-bash
[Top][All Lists]
Advanced

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

documentation glitches re "interactive"


From: ctm
Subject: documentation glitches re "interactive"
Date: Sun, 7 Jul 2002 21:27:58 -0600 (MDT)

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -D_GNU_SOURCE  -I.  -I. -I./include 
-I./lib -O2 -march=i386 -mcpu=i686
uname output: Linux newbie.ardi.com 2.4.19-pre8 #5 Sat May 18 16:41:40 MDT 2002 
i686 unknown
Machine Type: i686-pc-linux-gnu

Bash Version: 2.05a
Patch Level: 0
Release Status: release

Description:

        The bash "Interactive Shell Behvior" info page item #4 says
that PROMPT_COMMAND will be executed when the shell is interactive,
but testing shows that an interactive shell that is running from a
file won't execute PROMPT_COMMAND, but an interactive shell running
from a here document will.  The same page doesn't mention that "exit"
will be printed on stderr when an interactive shell exits.

        The info page for the builtin set command doesn't mention
"-i", but the help command does.  Bash accepts "set -i" and "set +i",
but neither appear to affect the interactive status of bash.

Repeat-By:

Run the following script with --norc --noprofile --noediting -i
and you'll see output of:

Nothing yet
bash-2.05a$ bar
bash-2.05a$ bar
bash-2.05a$ bar
bash-2.05a$ exit

The first line shows that even though "-i" is used when the script is invoked,
PROMPT_COMMAND is ignored.  The next three lines show that when the script
source is coming from a here document and "-i" is specified, PROMPT_COMMAND
is indeed executed, even after "set +i".  The final line shows that
"exit" is printed even after "set +i".

#! /bin/bash
PROMPT_COMMAND="echo foo"
set -i
set +i
echo Nothing yet
bash --norc --noprofile --noediting -i << 'EOF'
PROMPT_COMMAND="echo bar"
set -i
set +i

Fix:
Easiest fix is to change the documentation.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]