0

I modified my ~/app-root/data/.bash_profile to include a line where I set my PS1 environment variable, but after saving the changes, logging out and logging in again (via SSH), I still get the same default prompt, which is "[\H \W]>". The shell is reading my changes because I do get access to an alias that I defined in my modified .bash_profile, so I think the PS1 variable must be overwritten after the profile is read.

Somehow related, why is $HOME not being abbreviated when using \W or \w in the PS1 value?

Eric
  • 111
  • 2

1 Answers1

1

Via experimentation, I think it's safe to say that at the moment, the OpenShift software overrides the "usual suspects" (e.g. PATH, PS1, HOME) after it reads your .bash_profile. In order to customize your prompt (and any other environment settings), you need to manually execute a shell script (e.g. as soon as you log in). Therefore, my solution was to:

  • Create a shell script (e.g. fixShell.sh) in your $OPENSHIFT_DATA_DIR with all your changes: export HOME="${HOME%/}" export PS1="\w > " export TMOUT=3600 unset TMOUT
  • Print a reminder every time to manually execute the above script, so change .bash_profile to echo a colorful reminder: COL_BLUE="\x1b[34;01m" COL_RESET="\x1b[39;49;00m" echo echo -e $COL_BLUE"COMMAND TO EXECUTE FOR PROPER CONFIGURATION OF ENVIRONMENT:"$COL_RESET echo echo "source app-root/data/fixShell.sh"

The reason the default prompt doesn't abbreviate the home directory correctly is because the HOME variable contains a trailing slash ('/'), which once removed, works correctly in the prompt. Coincidentally, there's a trailing slash in all the $OPENSHIFT_* directory-related variables.

Eric
  • 111
  • 2