|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Tuesday, 16 November 1999||Author: Mike Chan|
|Published to: news_learn_firststep/Firststep News||Page: 1/1 - [Std View]|
Autocomplete of hosts!!!
If you're like me, you see being lazy as a good trait... =p You've probably experienced the joys of autocomplete if you're using one of the more advanced shells (tcsh, bash) but what about you heavy duty ssh'ers out there. You have to type out the whole hostname!!! Here's a quick pointer on how to get your shell to autocomplete a lot more than just filenames...
I started looking around for the source file that contained the autocomplete functionality of tcsh, and after a while, i finally found some code sections. However, uppon further exampination of the directory, i found that there was a file called complete.tcsh.... I thought "hmm... looks promising" so i opened it up in vi, and voila, there was the script that i was looking for so desparately... a 27k script file that allowed very fine tuning of what autocomplete can do autocomplete of arguments, hosts, files, etc.etc.etc. I copied out the complete.tcsh file, and sourced it, and sure enough, my autocomplete got a steroid shot.
A quick dump of a bunch of host names into .hosts allowed me to autocomplete most of the hosts that I was looking for. ssh isn't a default autocomplete command, but the script file is clear enough that making ssh act like telnet is simply yanking a line and changing telnet to ssh. I urge all the lazy people out there to grab a copy of the tcsh source, take the complete.tcsh, and slap it into their .cshrc file. =)