Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm having an interesting issue with XFCE Terminal/Gnome Terminal (not reproducible in XTerm), where executing bash or logging in using login or su will open a new Bash instance inside a Bash instance as shown:

_randall@manbearpig:/home/randall[root@manbearpig randall]#

Ctrl+D and exit both exit back to the original bash instance. How do I make these terminal emulators behave like Xterm, which opens the new user account or bash instance over the original one?

share|improve this question
2  
I don't understand the problem. typing bash, login or su are SUPPOSED to start a new shell. What is it that you expect to happen? Because, I cannot see where your system is doing anything wrong. if you want to open another TERMINAL program, then type gnome-terminal or whatever the program name is. Bash is a shell, where you type commands, gnome-terminal, xterm, konsole (and lots more) are just terminal emulators which show the output of a shell (bash/sh/dash/ksh/csh/zsh...) –  lornix Jul 9 '12 at 11:38
add comment

3 Answers

up vote 1 down vote accepted

I don't understand the problem. typing bash, login or su are SUPPOSED to start a new shell.

What is it that you expect to happen?

I cannot see where your system is doing anything wrong.

if you want to open another TERMINAL program, then type gnome-terminal or whatever the program name is.

Bash is a shell, where you type commands, gnome-terminal, xterm, konsole (and lots more) are just terminal emulators which show the output of a shell (bash/sh/dash/ksh/csh/zsh...)

share|improve this answer
    
I understand that those commands start new shells; sorry for causing confusion. The issue I'm having is purely cosmetic; typing su into an XTerm window and logging in won't cause duplication of prompt (i.e. user@hostname[user2@hostname]); rather, you'll end up with just the second prompt until you log out of it or exit the window. –  Randall Ma Jul 9 '12 at 16:15
1  
That is likely something in your PS1 environment variable being displayed, and something in your shell startup scripts which does that. If you're using bash, check the files in /etc/bash*, $HOME/.bash*. Just need to figure out which file/script is being cute and making the huge prompt. –  lornix Jul 9 '12 at 17:08
    
It was the export TERM=screen line in my bashrc. This also fixed some spacing in my IRC client and IM client. Thank you so much! :) –  Randall Ma Jul 9 '12 at 17:19
add comment

if

_randall@manbearpig:/home/randall[root@manbearpig randall]#

is not the prompt string you expect, then check PS1 environment var which contains the prompt string format. Search "PROMPTING" in bash manual to read more about PS1.

share|improve this answer
    
My PS1 variable (the default) is the one I prefer; my issue is a cosmetic one: using a terminal emulator like XTerm will display [randall@manbearpig randall] upon executing the bash command in the home dir, but Gnome-Terminal and XFCE Terminal give _randall@manbearpig:/home/randall[randall@manbearpig randall]#, which seems unnecessarily long and ugly from a usability standpoint. –  Randall Ma Jul 9 '12 at 16:20
add comment

You would have to use something like:

exec bash # or exec login or exec su

But be careful, as this replaces the parent process, the whole window/tab will likely die and there is no guarantee the new shell will "save" it. You'll have to try it yourself, I can only guarantee it works in Konsole.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.