Subject: Re: sh backtick deficiency?
To: Hubert Feyrer <hubert.feyrer@rrzc1.rz.uni-regensburg.de>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: current-users
Date: 03/30/1998 07:32:40
>I still suspect that's a bug in our sh, but the manpage
>doesn't say enough about backtick expansion, and i don't have any POSIX etc.
>standards around to verify the correct behaviour.
The shell has *always* expanded backtick text into separate arguments, and
it better keep doing so. I just verified that it did so on 7th Edition UNIX
thanks to the PDP11 simulator mentioned on this list a while back; I'd have
verified it for V6, but V6 didn't have sed, my favorite test case.
Consider the common data-reduction case of having a bunch of files, some of
which you want to hand to a program based on whether they contain a string:
$ grep string2 `grep string1 f? | sed -e 's/:.*//'`
If backtick evaluated into a single argument word, that would obviously not
work. I've been doing that since I started using 6th Edition, and I'd like
to keep doing that. ;-)