You are not logged in.

#1 2010-11-10 14:23:41

zmbmartin
Member
Registered: 2009-06-18
Posts: 43

Use autocomplete in simple bash command/aliases

I have a really cheesy alias basically to use to cd into directory in public_html

cdw() {
  cd ~/public_html/$* 
}

how do I get that to use autocomplete with it?

Thanks

Offline

#2 2010-11-10 14:50:07

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,799
Website

Re: Use autocomplete in simple bash command/aliases

you'll have to write a completion file under /etc/bash_completion.d/.  you can take a look at some of the ones in there for examples (try to find a simple one). 

you basically have to build a list of what to complete (probably ~/public_html/* in your case), then hand that off to a completion function, source the file and try it.

Offline

Board footer

Powered by FluxBB