The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-02-2009
mrwatkin mrwatkin is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 37
bash history and command line wrapping

By default, we use ksh (88) as our shell. I prefer bash, so I added this line to my .profile:

Code:
exec bash -o vi

I also added this to my .bashrc?:

Code:
#***********************************************
#These are important tweaks specific to BASH:
#***********************************************
#this one makes sure that long commands strings line wrap to the next line
[ -z "$PS1" ] && return

#instead of wrapping onto the start of the same line.
shopt -s checkwinsize

#this corrects typos when spelling out paths.
shopt -s cdspell  

alias c=clear

Of course, the alias works fine, however, when I try to use the up key to pull up a previous command from the history, it doesn't work until I press the down key first. I also can't get the line wrapping to work correctly. When I start with a prompt like this:

Code:
myBashPrompt>

I end up with this after a long command:

Code:
andashPrompt> This is what happens when I type a really long comm

If you noticed, the wrap overwrote the prompt. How do I get this to wrap correctly onto a new line? Also, how do I get my bash history to come up without having to press down, up?

I should also mention that I am using putty to ssh into our machines.

Last edited by mrwatkin; 07-02-2009 at 01:56 PM..