On 11/20/2011 12:05 PM, Ville Skyttä wrote: > On 11/20/2011 02:45 AM, Igor Murzov wrote: >> What about something like this?: >> ------------------------------------------ >> $ for f in /usr{,/local}/lib{,64}/valgrind/*; do >> [[ -x "$f" && "$f" != *.so ]] && echo "$f" | sed -ne >> 's/^.*\/\(.*\)-\([^-]*\)-\([^-]*\)/\1/p' >> done > > Seems to work for me. But it could be improved at least to test the != > *.so case before the -x to save some stat calls, use printf instead of > echo, and drop the unnecessary quoting inside [[ ]].
Actually, even better is to pass sed's stdin with <<<$f instead of printf or echo and a pipe. _______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel