[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Completion based on both prefix and suffix
From: |
Peng Yu |
Subject: |
[Help-bash] Completion based on both prefix and suffix |
Date: |
Sat, 27 Apr 2013 10:08:09 -0500 |
Hi,
I sourced the following bash script.
~$ cat main.sh
#!/usr/bin/env bash
function _mycomp {
echo
echo '_mycomp:BEGIN'
printf '_mycomp:$@ = %s\n' "$@"
echo '_mycomp:END'
}
function mycomp {
:
}
complete -F _mycomp mycomp
~$ . main.sh
When I type <TAB> after 'ma' in 'ma.sh', I'd like to get only ma but
also what is after it, i.e. '.sh', so that I can complete the complete
the command not only based on prefix but also on suffix. Is it feature
available in bash?
~$ mycomp a ma.sh
_mycomp:BEGIN
_mycomp:$@ = mycomp
_mycomp:$@ = ma
_mycomp:$@ = a
_mycomp:END
^C
--
Regards,
Peng
- [Help-bash] Completion based on both prefix and suffix,
Peng Yu <=