LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-15-2015, 10:15 PM   #1
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Rep: Reputation: 24
Korn and the Arrow Keys


Apparently, never the twain shall meet.

There are supposedly ways to make them function as they do in bash.

I've searched the internet. I've searched the forums here. Not without result mind you. I've come across an article of three that state I need to edit either my .kshrc file, or my .profile. I can find neither. They're not in my home folder. I thought maybe .kshrc might be in /usr/bin with ksh. I was wrong.

Here is the output of 'uname -a:
Code:
Linux localhost.localdomain 4.1.4-200.fc22.x86_64 #1 SMP Tue Aug 4 03:22:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
gnome-shell --version:
Code:
GNOME Shell 3.16.3
Thanks for your help,
Doug

Last edited by killingthemonkey; 08-15-2015 at 10:17 PM.
 
Old 08-15-2015, 11:18 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
I am not a ksh user, but from man ksh:

Quote:
Invocation.
If the shell is invoked by exec(2), and the first character of argument zero ($0) is -, then the shell
is assumed to be a login shell and commands are read from /etc/profile and then from either .profile in
the current directory or $HOME/.profile, if either file exists...
...
-E Reads the file named by the ENV variable or by $HOME/.kshrc if not defined after the profiles.
So the default locations are /etc/profile and ~/.profile if they exist. They may not exist by default, and apparently do not exist on your system, so simply create them. /etc/profile for all users, and/or ~/.profile for per user options.
 
Old 08-16-2015, 11:22 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
First, do not mess with /etc/profile, just leave it alone (your next system update will overwrite whatever you have done in /etc/profile).

You can create a ~/.profile, ~/.kshrc and ~/.exrc in your home directory and add whatever is needed there.

Check to see if you have an /etc/profile.d directory; if you do, you can profile instructions there. If not, then you'll be adding one or more of the above files in your home directory.

Let's say you want to invoke function keys (I'm assuming you want the command line editing keys?): here's the way to do that
Code:
# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
#  VISUAL=emacs         # ugh
#  VISUAL=gmacs         # double ugh
   VISUAL=vi            # ah, elegance
fi
That's part of my /etc/profile.d/ksh.sh file (do not create one of those if you don't have the profile.d directory, put that in your ~/.profile file).

The order of execution with when you log in is
  • /etc/profile
  • /etc/profile.d < if it exists on your system by default >
  • ~/.profle
Those files are plain text, owned by "you," not executable.

My ~/.kshrc file looks like this:
Code:
alias lc='/usr/bin/clear; /bin/ls ${LS_OPTIONS} -aCF'
alias ll='/bin/ls ${LS_OPTIONS} -al'
alias cls='clear'
alias hi='history -${LINES}'
alias rs='eval `resize`'
fubar-trona-/home/trona: cat .kshrc
alias lc='/usr/bin/clear; /bin/ls ${LS_OPTIONS} -aCF'
alias ll='/bin/ls ${LS_OPTIONS} -al'
alias cls='clear'
alias hi='history -${LINES}'
alias rs='eval `resize`'
My ~/.exrc file looks like this:
Code:
# Set options for vi
set autoindent showmode showmatch
In your ~/.profile file you'll need to add appropriate lines to execute the KornShell options:
Code:
#       set up default columns and lines
COLUMNS=80
LINES=40
export COLUMNS LINES
#       set up default group
GRPNAME=`groups | cut -d' ' -f1`
export GRPNAME
#       set up a good-size history
HISTSIZE=1000
export HISTSIZE
#       set up the ksh environment
ENV=${HOME}/.kshrc
export ENV
#       set up CVSROOT
CVSROOT=:pserver:trona@fubar.lan:/usr/local/cvsroot
export CVSROOT
#       change the PATH a little
export PATH=.:${HOME}/bin:${PATH}
export INSTALL_BASE=${HOME}
export LLDATABASES=${HOME}/LifeLines:.
export LLPROGRAMS=.:/usr/local/share/lifelines
#       make COLUMNS and LINES the screen size
eval `resize`
The only line you would need in ~/.profile is
Code:
#       set up the ksh environment
ENV=${HOME}/.kshrc
the rest of it is just for fun and setting things the way I want them.

Finally, you will need to edit whatever "terminal" you use so that it is a log in terminal. If you don't, you'll get a plain Jane default terminal. All of the terminal emulators have a way to check a box to make them log in terminals.

Hope this helps some.
 
Old 08-16-2015, 05:50 PM   #4
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Original Poster
Rep: Reputation: 24
tronayne,
Thanks for your help. You got me closer. Up and down arrows now cycle through my command history. Delete key is still throwing "^[[3~." Also, when I tab to complete a command, it completes the command, but it add the letter I last typed before I hit tab at the end. When I hit enter, I get no such file or directory.

I'm searching that now.

Edit: Also, right and left arrows don-t navigate. They just toggle whatever letter they are under from lower case to capital and back.

Thanks,
Doug

Last edited by killingthemonkey; 08-16-2015 at 05:56 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ubuntu 12.04 computer's arrow keys, page-up and page-down keys suddenly freeze julianvb Linux - Software 7 06-20-2014 06:33 AM
Arrow keys not working flamingvan Solaris / OpenSolaris 5 10-03-2006 05:47 AM
Shift-arrow and Alt-arrow keys don't work in xterm Aviv Hurvitz Linux - General 2 09-30-2006 03:43 PM
VIM and the arrow keys Buto Linux - Software 1 09-16-2004 07:38 PM
Arrow keys in nethack Levitate Linux - Games 3 08-22-2004 11:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration