I'm running Mac OS 10.10.3; Emacs is complied and installed via Homebrew; I run it as a GUI application and it reports
This is GNU Emacs 24.4.1 (x86_64-apple-darwin14.1.0, NS apple-appkit-1344.72)
of 2015-03-23 on boomer
Inside of Emacs shell or Emacs ansi-term, my prompt looks like this:
bash-4.3$ echo $PS1
\s-\v\$
But inside of Terminal.app, my prompt looks like this:
boomer:~ dgrady$ echo $PS1
\h:\W \u\$
The value of PS1
that Terminal.app sees comes from the system-wide /etc/bashrc
file, which reads
# 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
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
Why do Bash shells I start from within Emacs not see the same value of PS1
?
echo $SHELL
andecho $BASH
both report/usr/local/bin/bash
under Terminal.app, Emacs shell, and Emacs ansi-term.)