I noticed this morning that rkhunter doesn't bash complete.

After a quick blitz through a bunch of docs I came up with what you see below. I'll be honest here - I cribbed something up that seems to work but I don't completely understand it :-)

If you just plunk this in ~/.bash_completion and source it, it works, but it's missing the advanced abilities like listing the available hash options if you give it --hash. Even as is it's helpful. Perhaps someone could figure out the proper way to install this /etc/bash_completion.d (or equiv on some systems) when rkhunter is installed?

If I ever get time I believe reviewing this article gives me enough info to extend it further, but I'm just not able to do that right now.
http://www.debian-administration.org/articles/317

Comments?

Brian

# rkhunter(1) completion
# License: GNU GPL v2 or later
# cribbed from the sitecopy bash completion file - Thanks Eelco Lempsink <eelcolemps...@gmx.net>

_rkhunter()
{
        local cur

        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}

        case "$cur" in
            --*)
COMPREPLY=( $( compgen -W "$(rkhunter -h | grep -e '--\w' | awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- $cur ) )
                ;;
            -*)
COMPREPLY=( $( compgen -W "$(rkhunter -h | grep -e '- \w' | awk '{sub (",", "", $1); print $1}')" -- $cur ) )
                ;;
        esac

        return 0
}
complete -F _rkhunter -o default rkhunter


Attachment: PGP.sig
Description: This is a digitally signed message part

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Rkhunter-users mailing list
Rkhunter-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkhunter-users

Reply via email to