|[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 - [Printable]|
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...
|Page 1 of 1|
A while ago, I started asking around about how to auto-complete hosts because I ssh, ftp, and lynx around so much. It became clear that I was either going to have to write up a mother of a script to do autocomplete for me, or have to hack the tcsh.c to source a file for autocomplete words to match up against. My sysadmin finally said that I would probably have to write up my own script to do so. The next day, I went to download the source ROM for tcsh.
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. =)
|Page 1 of 1|