Consultor Eletrônico



Kbase 20727: Why Prompt Does Not Change With an OS Shell Using Bash Shell
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/06/2005
SUMMARY:

Developers who use the bash shell on UNIX or LINUX platforms might notice that the prompt "PS1" does not change when a sub shell is started from the Progress Procedure Editor either via the OS Shell or the UNIX statement.

Normally, the PS1 environment variable is set to $$ (PID of the shell) when creating a sub shell.

EXPLANATION:

This behavior can happen when there is a (.bashrc) file for the user. The .bashrc is always read by the bash command when a new instance of bash is started. The /etc/bashrc file set the PS1 environment variable, overriding the setting given by Progress.

SOLUTION:

Modify the /etc/bashrc so the PS1 environment variable is set only if it is undefined.

For example:

Use:

PS1=${PS1-"[\u@\h \W]\\$ "}

instead of:

PS1="[\u@\h \W]\\$ "

Another alternative, if the /etc/bashrc file cannot be modified or you prefer to do the change locally in the .bashrc file, is to ensure that the value of the PS1 is preserved if it is set to '$$ ' (that normally indicates it was set from a Progress sub shell).

For example:

TEMPPS1=
if [ "$PS1" == '$$ ' ]
then
TEMPPS1="\$\$ "
fi

#
# Content of the original .bashrc file
#

if [ "$TEMPPS1" = '$$ ' ]
then
PS1="\$\$ "
fi