The UNIX and Linux Forums  


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



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find command and wrapping in the script mirusko Shell Programming and Scripting 4 10-23-2008 05:46 PM
^p not giving command line history. akbar SUN Solaris 0 02-21-2008 01:15 PM
command line history Sowser UNIX for Advanced & Expert Users 1 01-05-2007 09:31 PM
Line wrapping problem when using awk placroix1 Shell Programming and Scripting 1 05-10-2005 12:44 PM
Wrapping a bash script for CGI andyj Shell Programming and Scripting 2 07-16-2003 01:46 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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..
  #2 (permalink)  
Old 07-03-2009
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
There is probably a term mismatch. Try telling putty to use vt220. And in the settings window, there is a section for "keyboard". You might want to experiment with different keyboard emulations. Usually the "Esc" is preferred.

To match this on the unix side, throw this into the .profile/.bashrc:
Code:
export TERM=vt220
You can also try xterm-color or xterm-ansi or just ansi.

There are several ways to tell bash to use the "vi" command-editing mode, but if you are only familiar with up/down arrow keys, then you might want to use "set -o emacs". Additionally, there's a file called ".inputrc" which is read normally by bash and will configure the keyboard how you like. Look at the manpage for "readline".
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0