[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange compgen behaviour
From: |
Mathias Dahl |
Subject: |
Re: Strange compgen behaviour |
Date: |
Fri, 25 Sep 2009 04:47:04 -0700 (PDT) |
User-agent: |
G2/1.0 |
> This has been an interesting topic!
I thought I should share the final version as well:
_mm() {
local cur files
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
files=$(find /home/mathias/Videos/movies/ -iname "*.avi" -type f -
printf "%P\n" | grep "${cur}" | sed "s/\\([][\\(\\) ,\']\\)/\\\\\\1/
g")
local IFS=$'\n'
COMPREPLY=(${files})
}
complete -F _mm mm
And the `mm' script needs to append the root folder, of course, like
so:
#!/bin/bash
mplayer "/home/mathias/Videos/movies/$1"
Works quite well. Maybe it will be useful to someone else too.
/Mathias
- Re: Strange compgen behaviour, (continued)
- Re: Strange compgen behaviour, Bernd.Eggink, 2009/09/25
- Message not available
- Re: Strange compgen behaviour, Mathias Dahl, 2009/09/24
- Re: Strange compgen behaviour, Mathias Dahl, 2009/09/24
- Re: Strange compgen behaviour, Greg Wooledge, 2009/09/25
- Message not available
- Re: Strange compgen behaviour, Mathias Dahl, 2009/09/25
- Re: Strange compgen behaviour, Mathias Dahl, 2009/09/25
- Re: Strange compgen behaviour, Andreas Schwab, 2009/09/25
- Message not available
- Re: Strange compgen behaviour, Mathias Dahl, 2009/09/25
- Re: Strange compgen behaviour, Bernd Eggink, 2009/09/25
- Message not available
- Re: Strange compgen behaviour, Mathias Dahl, 2009/09/25
- Re: Strange compgen behaviour,
Mathias Dahl <=