Re: Code editing feauture



Hallo, Michelle,

Du (linux4michelle) meintest am 23.04.08:

case `echo $1 |sed 's/^.*\.//'` in
     c|h)

[...]

The `echo $1 |sed 's/^.*\.//'` is striping the prefix/name from the
filename.  E.g.

    echo main.c |sed 's/^.*\.//'

will result in

    c

Better readable:

        case "$1" in
                *.c|*.h)
                # do something
                ;;
        esac

I should test if "case" makes "globbing" (with ? as 1-char-joker) or  
"regex" (with . as 1-char-joker) ...

Viele Gruesse!
Helmut



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]