Computing.Net > Forums > Linux > Starting terminal problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Starting terminal problem

Reply to Message Icon

Name: satimis
Date: October 3, 2003 at 22:11:44 Pacific
OS: RH9.0
CPU/Ram: P-II/256MB
Comment:

Hi all folk,

On starting 'terminal' (console window) it popup

bash-2.05b$

not as
satimis@localhost satimis>$

Kindly advise how to fix it

Thanks

B.R.
satimis



Sponsored Link
Ads by Google

Response Number 1
Name: blumini
Date: October 4, 2003 at 02:47:37 Pacific
Reply:

The prompt of the shell (bash) is set in /etc/bash.bashrc
Your prompt is set to BASH_VERSION.
Assuming that RH9.0 is not different to other Linux distros you can do:
echo $PS1
so you know what you have to look for in the next step.
Edit bash.bashrc with an editor like vi or kate. Go to the paragraph where the prompt is set for bash.
Probably you just have to comment/uncomment some lines there.
With full path on prompt your setting should look like that:
PS1="${_t}${_u}:\w${_p} "

This should give you
satimis@computername:workingdirectory>
where _u is a variable for user@host (if you are a simple user) or host (if you are root).
The variables _u and _p are set *before* PS1.

Mike Blum


0

Response Number 2
Name: satimis
Date: October 4, 2003 at 09:13:13 Pacific
Reply:

Hi Mike,

Thanks for your advice.

I carried out following test without result;

1)
First I made a spare copy of 'bashrc' and saved it to another folder.

2)
$ echo $PS1
[\u@\h \W] \\$

3)
As ROOT
# kedit /etc/bashrc

found following line

[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

4)
replaced "[\u@\h \W]\\$ " with
"${_t}${_u}:\w${_p} "
(from your advice with copy and paste command)

Saved and relogin

5)
Started 'terminal' window. It prompted the same.

bash-2.05b$
$ echo $PS1
\s-\v\$

6)
As Root
Copied back the spare copy of bashrc to
/etc/bashrc

7)
Relogin as USER/satimis

This time
$ echo $PS1
\s-\v\$

Kindly advise how to proceed.

I have a RH8.0 box running without problem. I compared the /etc/bashrc of them and found the line in question looked identical.

Can I copy /etc/bashrc of RH8.0 box and use the same on RH9 to fix the problem?

B.R.
satimis



0

Response Number 3
Name: The_File_Clerk
Date: October 4, 2003 at 14:01:55 Pacific
Reply:

Hi Satimis,

Just MHO, but I think you should check out the settings tab as what I assume to be Konsole that you're running.

As for what each character represents in the PS1 prompt, I'd look a the the man page for bash under PROMPTING.

HTH,
-J


0

Response Number 4
Name: blumini
Date: October 5, 2003 at 04:54:47 Pacific
Reply:

Well it seems that some Linux flavours are completely different, LOL.
Thanks to 'The_File_Clerk', the section 'PROMPTING' in the manpages should give you all the switches for your prompt that you need.

[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
What happens if you delete the first part of the command?

Here is my bashrc:
# Other prompting for root
_t=""
if test "$UID" = 0 ; then
_u="\h"
_p=" #"
else
_u="\u@\h"
_p=">"
if test \( "$TERM" = "xterm" -o "${TERM#screen}" != "$TERM" \) -a -z "$EMACS" ; then
_t="\[\e]2;\u@\h:\$(ppwd)\007\e]1;\h\007\]"
fi
fi
# With full path on prompt
PS1="${_t}${_u}:\w${_p} "

so you can see how the variables are set,

HTH
Mike Blum


0

Response Number 5
Name: satimis
Date: October 5, 2003 at 07:51:24 Pacific
Reply:

Hi blumini,

I made 2 tests without result

1)
# [ "$PS1" = "\\s-\\v\\\$ " ] &&

PS1="[\u@\h \W]\\$ "

2)
# [ "$PS1" = "\\s-\\v\\\$ " ]

&& PS1="[\u@\h \W]\\$ "

In the second test, I could not

$ su -


The problem was caused after I failed to isse following command as ROOT on terminal

# ssh -X satimis@localhost

then I hit 'Enter' after a warning saying something not found popup. Afterward I closed the terminal.


My /etc/bashrc looks different to yours

if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
umask 002
else
umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
if [ -x /usr/bin/tput ]; then
if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
stty erase `tput kbs`
elif [ -x /usr/bin/wc ]; then
if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal
stty erase `tput kbs`
fi
fi
fi
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

if [ "x$SHLVL" != "x1" ]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
fi
fi
# vim:ts=4:sw=4


B.R.
satimis


0

Related Posts

See More



Response Number 6
Name: blumini
Date: October 6, 2003 at 01:35:21 Pacific
Reply:

Hi,
what I was posting is not my complete /etc/bash.bashrc, but only an essential part of it.
Take a look at /etc/sysconfig/bash-prompt-xterm
because the case section in your bashrc refers to it (case $TERM in xterm).
And I am not sure if logout/login is enough to make the new settings work or if you have to reboot.

Mike Blum


0

Response Number 7
Name: satimis
Date: October 6, 2003 at 06:11:21 Pacific
Reply:

Hi Mike,

1)
I could not locate

/etc/sysconfig/bash-prompt-xterm

# ls -al /etc/sysconfig/

could not find this file.

2)
I re-tried comment the line

# [ "$PS1" = "\\s-\\v\\\$ " ] &&

and rebooted the PC. The result was the same.

B.R.
satimis



0

Response Number 8
Name: blumini
Date: October 6, 2003 at 08:22:12 Pacific
Reply:

>>I could not locate
>>/etc/sysconfig/bash-prompt-xterm
I don't have this file too, but my bash.bashrc is completely different.
What you posted in Response Number 5, was it your complete bashrc ?

Probably you have some personal files in your home dir ?
.profile
.bashrc
???

Don't you have any alias ? E.g.
alias l='ls -alF'
alias o='less'

On behalf of your bash prompting I am running out of ideas.

Mike Blum


0

Response Number 9
Name: The_File_Clerk
Date: October 6, 2003 at 11:25:31 Pacific
Reply:

Hi,

Just an idea, but in the user "satimis" home directory, are there any .login files that could be controlling the inability for the prompt to be displayed?

Granted /etc/bashrc is called after login, but its called from .bashrc. If you edit /etc/bashrc, it will do nothing if its never called.

Just an idea,
-J


0

Response Number 10
Name: The_File_Clerk
Date: October 6, 2003 at 11:32:35 Pacific
Reply:

I just realized I parroted Mike's post.

>_<

Sorry about that, I'll shut-up now.



0

Response Number 11
Name: blumini
Date: October 6, 2003 at 13:18:59 Pacific
Reply:

Well I fiddled around with the prompting and that gave me a prompt like you are searching for:
PS1="\[\033[m\]\[\u@\033\[ \h\033\[m \w\]\\$\[\e\[m\] "

This worked for me, immediately, no reboot, no re-login.
Just type this in or copy it.
Of course it is just one (1) line.

HTH
Mike Blum


0

Response Number 12
Name: satimis
Date: October 7, 2003 at 09:03:26 Pacific
Reply:

Hi blumini,

I discovered the trick.

The file /home/satimis/.bashrc was found missing.

# cp /etc/bashrc /home/satimis/.bashrc

Then it worked

Now starting USER's terminal its shows;

[satimis@localhost satimis]$

I also rebooted the PC to reconfirm it is working

Lot of thanks for your advice and time spent, also to The_File_Clerk

B.R.
satimis



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Starting terminal problem

Starting GNOME problem www.computing.net/answers/linux/starting-gnome-problem/24086.html

Starting Thunderbird problem www.computing.net/answers/linux/starting-thunderbird-problem/23674.html

start terminal in gnome panel www.computing.net/answers/linux/start-terminal-in-gnome-panel/18828.html