Jeff Newmiller wrote:
> 
> On Tue, 11 Dec 2001, David Douthitt wrote:
> 
> [...]
> 
> > grep -v '^'$PKGNAME'$' $PKGD/pkg.old > $PKGD/packages
> 
> why the rigamarole with the single quotes?
> 
>  grep -v "^$PKGNAME$" $PKGD/pkg.old > $PKGD/packages

I was playing chicken :)

The first breaks down this way:

string (not scanned by shell): '^'
variable: $PKGNAME
string (not scanned by shell): '$'

The second is a little more dicey - how does one know that the shell
won't get confused or upset by the final '$'?  With the double-quotes,
the shell scans the string.  Given your example, I think I'd prefer
using:

"^${PKGNAME}$"

because it forces the name upon the shell - prevents even more
confusion...

_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user

Reply via email to