1

I installed drush and as part of the installation it makes some changes to the PROMPT

...
# Optional. Enrich the bash startup file with completion and aliases.
drush init
...

Whenever I execute an command at the prompt I get the message:

bash: __drush_ps1: command not found

The env command displays PROMPT_COMMAND as

PROMPT_COMMAND=__git_ps1 "\u@\h \w" "$(__drush_ps1 "[%s]") \\\$ "

I think somewhere at the global level the PROMPT_COMMAND variable is set to that value but I can't locate it in any of the global environment variables and profile scripts.

Because drush was installed as root commands executed as root don't produce that error message. root has a .drush directory with some drush scripts.

UPDATE: After inquiring from the drupal forum https://drupal.stackexchange.com/questions/198484/where-does-the-drush-installtation-command-set-the-prompt-command-variable/198487 I know which of the drush installation commands create that setting. What I can't find is which of the Linux bash and environment files execute that setting at logon time. Any new account I create produces that error when I execute a command at the shell, so the setting must be at a global level. One of the files here or in the related directories /etc/{bash.bashrc,bash_completion, bash_completion.d,environment} must have the command that sets the PROMPT_COMMAND variable at logon time, but I can't find it.

Any ideas?

vfclists
  • 7,531
  • 14
  • 53
  • 79

1 Answers1

4

The list of files that bash loads during startup is documented in the manual. There's ~/.bash_profile, ~/.profile, ~/.bash_login and /etc/profile for a login shell, and ~/.bashrc (and /etc/bash.bashrc or similar on some systems) for an interactive shell.

It's common for these files to include other files, and there's no general rule that would give you an exhaustive list of where to look.

Run bash -ix </dev/null 2>trace (or bash -lx </dev/null 2>/trace if you want to start a login shell). This writes a trace of all the commands that bash executes to the trace file. Search for PROMPT_COMMAND in that trace, and search a source or . command before it to find where it was set. It's possible that PROMPT_COMMAND is set in a function that's defined in one file and executed in another file, in which case you may need to explore the trace further.