| Globbing happens to command lines after parameter substitution.

But wouldn't that mean that the following...

echo 'echo '$2' | sed '"s/^/ / ; s/\$/ / ; s/ $1 / / ; s/^ // ; s/ \$//"

...which produces...

echo * | sed s/^/ / ; s/$/ / ; s/ . / / ; s/^ // ; s/ $//

..._should_ have shown '*' in its expanded version?  This was my "bone" of
yesterday and remains so today (no amount of chewing seems to help <g>).

----

|         zap_word() {
|                 sed "/^$1\$/d"
|         }
|
| and you'd use it like this:
|
|         flist=`echo "$flist" | zap_word "$fname"`

I like it!

| BTW, if I wrote "gimme all the things in this dir which aren't dirs"
| I'd probably say
|
|         flist=
|         for fname in `ls -a`
|         do  [ -d "$fname" ] || flist="$flist $fname"
|         done

That's similar to what I'm actually using (building flist rather than
tearing it down).

| Not that your way is invalid. But mine's shorter and faster (it doesn't
| invoke lots of copies of sed to do things).

Right -- there are lots of ways to go about most things, I think.  Although,
I ran some timed tests and using the "teardown" routine along with 'ls -a'
is a bit faster than the "build" routine (and your build is faster than my
build:).

Thanks again.  Although I'm starting to "intuit" a lot of what you're
saying, it really helps to have someone explain it!

bd



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

Reply via email to