Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have some AIX 7 servers that are restricted to what software I can install and wonder if I can get ksh to use the tab key to complete filenames at the shell promot.

The man pages are sparse for ksh and I don't see any relevant questions here covering this ground. Due to the majority of users using ksh, I'm hesitant to shift my shell to bash - but I suppose that's an easy out.

I log in initially from a PC using putty/ssh and work mostly from xterm once the X11 forwarding brings back the traffic to Hummingbird Exceed on the PC.

Can /usr/bin/ksh that ships with bos.rte.shell for AIX 7.1 be configured to trigger filename completion (which is normally triggered by pressing ESC+\ ) by pressing the TAB key?

share|improve this question
    
What does 'echo $TERM' has to say? –  schaiba Jul 19 '13 at 20:54
    
@schaiba - Thanks for catching my incomplete phrasing of the question. My $TERM is xterm whether I'm logged in over putty/ssh or have spawned xterms... –  bmike Jul 19 '13 at 20:59
    
Please include the value of ${.sh.version} in your question. Double TAB for filename completeion was added relatively late. –  Henk Langeveld Jul 21 '13 at 21:36
    
@HenkLangeveld I get a "bad substitution" error when I try to echo ${.sh.version} - The version of box.rte.shell is 7.1.1.16 –  bmike Jul 22 '13 at 13:27

3 Answers 3

up vote 2 down vote accepted

See if /usr/bin/ksh93 is available:

ksh93 --version

If it says

version         sh (AT&T Research)

then use that as your interactive shell. It will have the ${.sh.version} and should have the TAB expansion.

share|improve this answer
    
This is likely going to end up being the answer unless there's an obvious way to teach the old ksh new tricks. It appears the /usr/bin/ksh is intentionally not updated with features and the second binary has more recent features compiled. Since it seems to work out of the box, pressing tab works as expected now with little risk that other scripts will fail on a difference between ksh and ksh93. –  bmike Jul 22 '13 at 15:09
    
Actually, IBM probably followed the concept of changing names when changing interfaces, unlike what Sun did when they updated ksh to ksh93 in (Open)Solaris. –  Henk Langeveld Jul 22 '13 at 16:40

I gather your shell is in vi mode. Not sure this will work, as my AIX knowledge is limited, but yu can try to add this to your profile:

set -o emacs
bind "^I=complete"

Google says that ksh in AIX is kinda crippled from this point of view, so maybe bash would be a better bet. Hope this helps.

share|improve this answer
    
This doesn't work either in the ksh version I have installed. I prefer the vi bindings, but switched over to emacs to see if this would let the tab key work as expected. –  bmike Jul 22 '13 at 12:36

There is an alternative for this question.

First set vi mode for ksh:

$ set -o vi

After, you can use the Tab key this way. Example: You want complete the next path:

$ cd /usr/local/s

Type Tab key twice and You will see this:

$ cd /usr/local/s
1) sbin/
2) share/
3) src/

Assuming you want to option 2 (/usr/local/share/ folder), type 2 Tab (2 key followed by the Tab key). And You will see this:

$ cd /usr/local/share/ 

I hope have helped!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.