Subject: Re: sh backtick deficiency?
To: None <hubert.feyrer@rrzc1.rz.uni-regensburg.de>
From: Geir Inge Jensen <Geir.I.Jensen@runit.sintef.no>
List: current-users
Date: 03/30/1998 11:10:35
On 30 Mar, Hubert Feyrer wrote:
> On Mar 30, 10:50am, Geir Inge Jensen wrote:
>> I think you have to use
>> 	cvs add -m "`cat /tmp/cm`" sniffit
>>
>> Otherwise, cvs will try to add most of the output of that command as
>> files...
> 
> Well, sure i know how to work around this, my question rather was: do I really
> have to work around it? 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.

You said:

> $ cat /tmp/cm
> Network sniffer, via FreeBSD PR ports/6160.
> $ cvs add -m `cat /tmp/cm` sniffit
> cvs [add aborted]: no such directory `ports'

After expansion, that will be

  cvs add -m Network sniffer, via FreeBSD PR ports/6160. sniffit

I don't know why cvs don't bail out on the first non-existent file
(sniffer), maybe its parsing the argv-list backwards? Anyway, I don't 
think this is a bug. You are giving cvs a message containing more than
one word, and you must therefore quote that somehow. 

I can see your point. If the shell built the arguments to the command
with one of them containing the output of the backtick command, the
extra quotes would not be necessary. However, my experience has always
been that the backtick expansion is done before the argument list is
built. I don't have the POSIX standards laying around, so I may be
wrong. 

Bye,
-- 
Geir Inge Jensen                                    gij@jk.priv.no
                                                    http://www.jk.priv.no/