On Tue, Dec 16, 2008 at 11:26:49PM +0100, Pavel Filipensky wrote: > Here is a draft which works fine for normal mount points: > > http://cr.opensolaris.org/~pavelf/6778894-v2/
... > Any suggestions how to implement a robust grep in a shell? This is what you added: 239 +# Find if a given string is in a pipe separated list 240 +# Usage: string_grep string pattern 241 +# Example: 242 +# string_grep /var/tmp "/var/tmp|/net/server.domain|/home/user" 243 +string_grep() { 244 + eval "case $1 in '$2') return 0;; esac; return 1" 245 +} Try: string_grep() { eval "case \"$1\" in $2) return 0;; esac; return 1" } The difference: a) cause $1 to be quoted in the eval'ed string, b) cause $2 not to be so quoted. % string_grep foo\* f\* && echo hi hi % string_grep foo\* foobar\* && echo hi % Nico --