Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choosing a file in Korn shell

Status
Not open for further replies.

ddrillich

Technical User
Jun 11, 2003
546
0
0
US
Good Day,

I'm using the Korn shell, doing the following:

$ set -o vi
$ ls lo
Followed by ESC =

The shell displays:
1) local.cshrc
2) local.login
3) local.profile

How can I choose, let's say, the second option? My book says that 2 = will complete the command with the second option, but it isn't happening.

Any ideas?

Thanks,
Dan
 
What do you mean by 'choose'? Do you want to run local.login? Sorry if I've misunderstood the question.
 
Hi Ken,

I mean that the shell will complete the command to be:
$ ls local.login

Thanks,
Dan
 
Sorry, Dan, I've been unable to do this successfully either. It might be a pain, but would it be possible to transcribe what your book has to say about this exactly? Would be interested to hear other views/opinions.
 
Hi Ken,

The book is "Korn Shell" from O'Reilly
It says on page 58:

Finally, the command = does the same kind of filename expansion as the * shell wildcard, but in a different way. Instead of expanding the filenames onto the command line, it prints them in a numbered list with one filename on each line. Then it gives you your shell prompt back and retypes whatever was on your command line before you typed =. For example, if the files in your directory include program.c and problem.c, and you type pro followed by ESC and then =, you will see this:

$ cc pro ESC = typed at this point
1) problem.c
2) program.c

$ cc pro

Beginning with ksh93m, prefixing the = command with a count indicates selection of a particular option. Returning to the previous example: after listing both program.c and problem.c, the command line looks like this:

$ cc pro

If you want program.c, it's enough to type 2 =, and the shell picks expansion number 2. The command line changes to:

$ cc program.c


Ok, so it's clear that this feature is available since ksh93m. How do I find out which Korn shell version is being invoked?

Thanks,
Dan
 
Dan, that's probably the key issue here, and I'm afraid I don't know!! However, my guess is that earlier versions of Solaris wouldn't be ksh93m compatible. No doubt someone else will know....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top