LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Problems using Putty (FreeBSD) (https://www.linuxquestions.org/questions/linux-software-2/problems-using-putty-freebsd-664217/)

paragkalra 08-20-2008 10:36 PM

Problems using Putty (FreeBSD)
 
Hello all,

I am using "putty" to ssh a Freebsd machine. The problem that I am facing is that once I change to bash shell from C shell and I enter recursively into many directories using cd command then every thing I type after the prompt goes onto next line and coincides with the prompt of second line.

e.g.

Quote:

# cd /tmp/one/two/three/four/five/six/seven/eight/nine/ten/
intel:/tmp/one/two/three/four/five/six/seven/eight/nine/ten #

intel:/tmp/one/two/three/four/five/six/seven/eight/nine/ten # cat /etc/apache2/httpd.confintel:/tmp/one/two/three/four/five/six/seven/eight/nine/ten #
How can I stop this behavior of Bash or is it due Putty?

I think what basically I want is the following:

Quote:

intel#
intel#pwd
/
intel# cd /tmp/one/two/three/four/five/six/seven/eight/nine/ten/
intel#
intel#pwd
/tmp/one/two/three/four/five/six/seven/eight/nine/ten/
This should resolve the issue? Any pointers ?

blackhole54 08-21-2008 02:53 AM

The prompt is controlled by the environmental variable $PS1. (There are also $PS2, $PS3, and $PS4 for special purposes; see bash man page if interested.)

If "intel" is your hostname, then I think what you want is one of the following:

Code:

PS1='\h\$'
PS1='\H\$'

I suggest trying this interactively to see if it gives you the result you want. Or check the man page for many other options for the string to contain. For example to do a prompt similar to what you currently have, but just show the basename of the directory (i.e. the last part of the path) try:

Code:

PS1='\H:\W\$'
In all of the above, I am assuming that the hash symbol (#) is the result of being root. The above definitions will cause that to change to dollar sign ($) for normal users.

After interactively getting the prompt the way you like it, you can add that line to /etc/profile or ~/.bash_profile as appropriate on the remote machine.

paragkalra 08-21-2008 12:30 PM

Thanks blackhole54....the workaround did the trick...........


All times are GMT -5. The time now is 11:42 AM.