5

Somehow my bash prompt got changed to "elementary:~ steven$" and I want to change it back to the default prompt. I've added the following first to ~/.bashrc then to ~/.profile:

export PS1="\s-\v\$ "

Neither get executed when I open Terminal. If I run the command source on either file it works fine for the remainder of that session.

Is there something I'm overlooking here?

EDIT: Here's output from what Ian suggested:

elementary:~ steven$ bash --login --verbose
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
fi
/usr/libexec/path_helper -s
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/usr/local/AVRMacPack/bin"; export PATH;

if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
fi
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
if [ -e "/usr/local/AVRMacPack" ]; then
PATH="$PATH:/usr/local/AVRMacPack/bin"
export PATH
fi

# Setting PATH for Python 3.2
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"
export PATH
elementary:~ steven$ which bash
which bash
/bin/bash
1
  • What was the default prompt before? Are you talking about a hostname change to 'elementary'?
    – jsejcksn
    Sep 12, 2011 at 3:43

3 Answers 3

6

.bashrc is only executed for non-interactive shells according to the bash man page.

.bash_profile is executed for login shells.

The .profile file is loaded by Korn shells. I don't know that bash pays any attention to this at all. I couldn't find any reference to it in the bash man page.

On OS X the Terminal.app program runs a login shell for every single new Terminal.app window you open.

So you want to put your prompt setup in .bash_profile.

You could always do the following in .bash_profile. It's not uncommon but I can't say what kind of repercussions it could have:

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

Then you wouldn't have to maintain two files.

5
  • Still not working. Is there something that could be overriding it?
    – user88210
    Sep 12, 2011 at 3:14
  • 1
    It's possible bash is being invoked with --noprofile or --norc. Try this, from a prompt run: bash --login --verbose -- does it print anything useful about what it's running? Also: which bash -- check to make sure bash hasn't been aliased.
    – Ian C.
    Sep 12, 2011 at 3:17
  • I updated the first post with the output. It doesn't look like anything interesting or nulling is being executed.
    – user88210
    Sep 12, 2011 at 3:36
  • 1
    Add the following to the start of ~/.bash_profile and ~/.bashrc: echo "Start of file $0". And to the end of each file: echo "End of file $0" and then try bash --login --verbose -- do you see the output from those? Are the files being sourced as expected?
    – Ian C.
    Sep 12, 2011 at 3:53
  • 2
    .profile is read by bash as well, but only if .bash_profile does not exist. Sep 12, 2011 at 7:38
0

I might be incorrect but if bash is your shell, you must place that in your ~/.bash_profile and not your .bashrc.

0

In case you messed with your bash control for any reason and you wanna load your TERMINAL .profile in every session again, just write your ~/.bash_profile like so:

if [ -f ~/.profile ]; then
   source ~/.profile
fi

...and start a new session to check if everything went back OK

You must log in to answer this question.