emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#16618: closed (How to show the diff command when t


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#16618: closed (How to show the diff command when there is a difference when comparing two files?)
Date: Sun, 30 Mar 2014 05:23:02 +0000

Your message dated Sat, 29 Mar 2014 22:22:40 -0700
with message-id <address@hidden>
and subject line Re: How to show the diff command when there is a difference 
when comparing two files?
has caused the debbugs.gnu.org bug report #16618,
regarding How to show the diff command when there is a difference when 
comparing two files?
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
16618: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16618
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: How to show the diff command when there is a difference when comparing two files? Date: Sat, 1 Feb 2014 13:27:55 -0600
Hi,

The following shows that diff -r print the command e.g. "diff -r
/var/folders/ft/9trh7jt57kqc_hyq0wm5rny40000gx/T/tmp.wcrIdLELps/b.txt
/var/folders/ft/9trh7jt57kqc_hyq0wm5rny40000gx/T/tmp.AJieJ9Zk1O/b.txt"
if there is an error. I'm wondering if I just compare two files, it is
possible to print the diff command if there is a difference between
the two files? Thanks.

~/linux/test/gnu/diffutils/diff/-r$ cat main.sh
#!/usr/bin/env bash

dir1=$(mktemp -d)
dir2=$(mktemp -d)
echo 'Hello World' > "$dir1/a.txt"
echo 'Hello World' > "$dir2/a.txt"

echo 'Hello World' > "$dir1/b.txt"
echo 'Hello World!' > "$dir2/b.txt"

#echo 'Hello World' > "$dir1/c.txt"
echo 'Hello World' | gzip -n > "$dir1/c.txt.gz"
diff -r "$dir1" "$dir2"

~/linux/test/gnu/diffutils/diff/-r$ ./main.sh
diff -r /var/folders/ft/9trh7jt57kqc_hyq0wm5rny40000gx/T/tmp.wcrIdLELps/b.txt
/var/folders/ft/9trh7jt57kqc_hyq0wm5rny40000gx/T/tmp.AJieJ9Zk1O/b.txt
1c1
< Hello World
---
> Hello World!
Only in /var/folders/ft/9trh7jt57kqc_hyq0wm5rny40000gx/T/tmp.wcrIdLELps:
c.txt.gz

-- 
Regards,
Peng



--- End Message ---
--- Begin Message --- Subject: Re: How to show the diff command when there is a difference when comparing two files? Date: Sat, 29 Mar 2014 22:22:40 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
I'm wondering if I just compare two files, it is
possible to print the diff command if there is a difference between
the two files?

Not in diff itself, but it's easy to do from a shell script.  E.g.,

command="diff a b"
$command >output || {
  echo "$command"
  cat output
}


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]