[blfs-support] Wrong prompt and "file not found" with xterm - BLFS 7.6

Bruce Dubbs bruce.dubbs at gmail.com
Tue Dec 16 15:02:04 PST 2014

rhubarbpieguy at gmail.com wrote:
> My BLFS 7.6 xterm window displays the wrong prompt, doesn't recognize
> aliases, and doesn't allow sourcing scripts.  Its prompt is "sh-4.3"
> although I have PS1="/w >" in /etc/bashrc.  Aliases don't execute and
> attempting to source a script results in "file not found."
> However, if I exclude the "*VT100*locale: true" line in
> /etc/X11/app-defaults/XTerm" all problems disappear.  With that one
> change I have the correct prompt, can use aliases, and source scripts.
> Although that fixes the problem, it still doesn't explain my error to me.
> Everything else works quite well but I'm curious as to what I'm doing
> wrong regarding X/xterm.  I hadn't the problem prior to BLFS 7.5 and
> don't see what I'm doing differently.  Thoughts?

The terminal is not your problem.  All the issues you mention have to do 
with bash initialization.

First of all you need to realize that starting an xterm does not run 
/etc/profile (or ~/.bash_profile, ~/.bash_login, ~/.profile) by default 
because the terminal invocation of bash is not started as a login shell. 
  It only runs ~/.bashrc.

The /etc/bashrc file needs to be sourced explicitly from the ~/.bashrc file.

The easiest way to debug your initialization scripts is to add an echo 
statement as the first line of each script and see what is used and the 
order that they are run.

For example, place 'echo ~/.bashrc' in the ~/.bashrc file.

The aliases and PS1 (and PS2/3/4 if they are customized) need to be set 
for every subshell as they are not inherited from a parent shell.

   -- Bruce

More information about the blfs-support mailing list