> Does this make stuff clearer?

Very much so!  Thanks for the great explanation!

> Also, you want to use '' instead of "" in the sed argument. Otherwise your
$
> in "s/ $//" can be misinterpreted. It is best to use '' unless you really
> need parameter substitution to occur. Safer.

I ended up with the following function:

zap_word() {
        # Arguments:    "word to delete" "word list to delete from"
        echo $2 | sed "s/^/ / ; s/$/ / ; s/ $1 / / ; s/^ // ; s/ $//"
}

In this case, double quotes are needed because of the $1 usage.  I was
delighted when Matthew suggested the double quotes, as that got it working
for me.  Even better though, is now I understand *why*. :)

Thanks again!

bd



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to