Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

ksh command history and tab completion

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> SFU / Interix - Getting Started >> ksh command history and tab completion Page: [1]
Login
Message << Older Topic   Newer Topic >>
ksh command history and tab completion - Apr. 12, '05, 2:19:13 PM   
xgx

 

Posts: 2
Joined: Apr. 12, '05,
Status: offline
Can anyone point me in the right direction to set up tab completion and command history using the arrow keys with ksh? I'm just starting out with SFU and these two things will help cut out the retype-a-long-line frustration factor. :)

Thanks.

Breeno
Post #: 1
RE: ksh command history and tab completion - Apr. 12, '05, 2:38:13 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
You work the command history with ksh using the same key strokes
as you do within vi. So 'j' is down, 'k' is up, 'h' is left and 'l' (ell) is right.
It's actually hardcoded into ksh this way (it's not using curses like csh/tcsh does).
So no using the arrow keys for direction AFAIK.

For tab completion, as described on the man page, the "vi-tabcomplete" can be used with the set
command either at the prompt or in a .profile file. You can also mix with the '-o' method on
the command line. The '-' and '+' are added to set or clear the option respectively (which looks
backwards to how you would normally think about it). So to turn it on:
set -o vi-tabcomplete
and then to turn it off:
set +o vi-tabcomplete

When you <tab> if there are multiple hits they get listed; you don't select from the list. You just
add to what is visible to remove the ambiguity then hit <tab> again.

Of course (as a csh/tcsh user myself) I must promote that csh allows for both 'vi'
and 'emacs' bindings for command line editing along with the tab completion (which is always on
by default)

< Message edited by Rodney -- Apr. 12, '05, 2:57:27 PM >

(in reply to xgx)
Post #: 2
RE: ksh command history and tab completion - Apr. 12, '05, 3:01:51 PM   
xgx

 

Posts: 2
Joined: Apr. 12, '05,
Status: offline
Rodney,

Thank you for your incredibly fast reply.

According to the man page, SFU is using pdksh. This is similar to OpenBSD, however, for some reason command history is traversable with the up and down arrow keys using the OpenBSD version. If you are correct, then this is their choice for compiling it, although it does seem to run contrary to the way OpenBSD usually does things (they almost always stick to the default behaviour).

AHA! A quick Google shows that Otto Moerbeek from OpenBSD stated on undeadly.org that their pdksh constitutes something of a fork since pdksh hasn't had a release since '99. OpenBSD has cleaned up the code and added some features, probably among them default tab completion and arrow key history. :) They have actually made pdksh the default shell for the 3.7 release of OpenBSD.

I assume SFU is using the original pdksh rather than the OpenBSD version? I'll try to make due with csh, I'm sure it will be fine.

Thanks again.

Breeno

(in reply to Rodney)
Post #: 3
RE: ksh command history and tab completion - Apr. 12, '05, 3:20:33 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Yes, ksh is based on "pdksh". While Softway was still running things Interix specific changes
were posted back to the pdksh maintainer. Microsoft hasn't done much utility and library updates
since taking over Interix in 1999 except a couple of items grabbed from the /Tools warehouse.
I would encourage everyone to bug Microsoft about this (send e-mail to MS support).
The squeaky wheel gets oiled.

> They have actually made pdksh the default shell for the 3.7 release of OpenBSD.

I personally think that is a mistake: BSD systems have csh as the default shell as rightly designated by god^H^H^H Bill Joy

(in reply to xgx)
Post #: 4
RE: ksh command history and tab completion - Apr. 12, '05, 10:39:55 PM   
markfunk

 

Posts: 670
Joined: Mar. 31, '03,
Status: offline
quote:

I assume SFU is using the original pdksh rather than the OpenBSD version?

Yes the Interix version is based on pdksh 5.2.13 with some enhancements:
namely: PATH_WINDOWS support and support to deal with Japanese code sets.
These enhancements were designed inside Microsoft. No MS changes have been published
nor were other external changes taken in.

(in reply to Rodney)
Post #: 5
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> SFU / Interix - Getting Started >> ksh command history and tab completion Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.031