On Wed, 12 Jul 2006 10:57:35 Oleg Goldshmidt wrote:
>
> Gilad Ben-Yossef writes:
>
> > The problem is that I tried various combiniations and none worked:
> >
> > diff -X ti_dontdiff -pBbNaur -X dontdiff this-kernel/ that-kernel/ -I
> > '\$Id' -I '\$Header' -I '\$Date' -I '\$Source' -I '\$Auther'
>
> Try double quotes?
>
> Here is diffing a file from two different branches of CVS:
>
> $ diff -Nur {prototype,exceptions}/src/clone.cc | grep "\$Id"
> - "$Id: clone.cc,v 1.27 2006/07/10 08:30:21 olegg Exp $";
> + "$Id: clone.cc,v 1.25.2.1 2006/07/10 08:16:40 olegg Exp $";
> $ diff -Nur -I"\$Id" {prototype,exceptions}/src/clone.cc | grep "\$Id"
> $
In bash you can use "\$VAR" or '$VAR' (i.e. you need not escape the $
when it is between apostrophes).
There is even more exotic form: $'<string>' which does interpret the
string by bash (NOT by the calling application).
Run the following script to see the differences:
#! /bin/bash -ex
VAR="example 1 \\ \$ \' \" \134 \044 \047 \042"
echo -E "$VAR"
echo -E '$VAR'
echo -E $'$VAR'
echo -E '$'"'""$VAR""'"
eval echo -E '$'"'""$VAR""'"
eval UNESC1='$'"'""$VAR""'" # unescaped var
echo -E "$UNESC1 | $UNESC2"
echo -E "$UNESC"
echo -E "\$VAR"
echo -E '\$VAR'
echo -E $'\$VAR'
On Wed, 12 Jul 2006 11:23:02 Shachar Shemesh wrote:
>
> > Try double quotes?
> >
> It makes no sense:
> > $ echo '\$Id'
> > \$Id
> > $ echo "\$Id"
> > $Id
> You really want the former, as "$" has special meaning in a regexp, and
> therefor is supposed to need a backslash before it if used literally.
> I'm not saying you are not right, just that it's strange that this is
> the case.
Shachar, you wrong. Gilad wants the `diff' program to see "$ID" not
"\$ID" which is what '\$ID' gives to the application (diff does not
substitute $ID with its environment value, bash does it).
Ehud.
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]