[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: |
Thu, 24 Sep 2009 15:05:07 -0700 (PDT) |
User-agent: |
G2/1.0 |
> ...but then I have to shell quote the file name myself to handle
> spaces, brackets of various sorts, comma characters etc. Will hunt for
> such a function and see. There are all sorts of crazy helper functions
> in /etc/bash_completion, of which I barely understand anything.
I did not find any generic way to quote/escape file names so I
hardcoded some chars I know exist in my file names and used sed:
_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
However, I don't like it, is feels ugly and one of these days there
will be some other funky char in some filename... :(
/Mathias
- Re: Strange compgen behaviour, (continued)
- Re: Strange compgen behaviour, Bernd Eggink, 2009/09/23
- Message not available
- Re: Strange compgen behaviour, Mathias Dahl, 2009/09/23
- Re: Strange compgen behaviour, Bernd Eggink, 2009/09/24
- Re: Strange compgen behaviour, Chet Ramey, 2009/09/24
- Re: Strange compgen behaviour, Bernd Eggink, 2009/09/24
- Re: Strange compgen behaviour, Chet Ramey, 2009/09/24
- Re: Strange compgen behaviour, Chris F.A. Johnson, 2009/09/24
- Re: Strange compgen behaviour, Chet Ramey, 2009/09/25
- 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 <=
- 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, 2009/09/25