LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-05-2006, 04:30 AM   #1
nadavvin
Member
 
Registered: May 2006
Distribution: ubuntu
Posts: 109

Rep: Reputation: 21
How can I use diff to difference between programs output?


Hello

How can I use diff to difference between programs output?
I can use diff with files: diff a b
How can I use in programs output?

I try diff `a.sh` b
but I get error of too many parameters.
 
Old 08-05-2006, 04:32 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
you need to redirect the output to a file for at least one. i assume you could pipe the input in for one...

./scriptname | diff filename
 
Old 08-05-2006, 05:17 AM   #3
nadavvin
Member
 
Registered: May 2006
Distribution: ubuntu
Posts: 109

Original Poster
Rep: Reputation: 21
thanks.

but it is ./scriptname | diff - filename
 
Old 08-05-2006, 05:31 AM   #4
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
You can also use process redirection:
Code:
#! /bin/bash
exec 3< <(ls ~)
exec 4< <(echo "Hi"; ls ~)
diff /dev/fd/3 /dev/fd/4
 
Old 08-05-2006, 05:35 AM   #5
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
Or more simply, on the command line:
Code:
diff <(command 1) <(command 2)
bash is wonderful, isn't it

Yves.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Output commands when programs run? TKS Slackware 2 12-13-2005 12:07 AM
Dual Boot diff Hard Disk diff OS on Suse 9.1 wilhem Linux - Newbie 1 08-13-2004 07:06 PM
Why do these programs hang, won't even output. ooagentbender Programming 3 12-15-2003 02:40 PM
"Diff" output format ganninu Linux - General 1 12-09-2003 10:39 AM
What's the difference between .diff and .patch? nidua18 Linux - Software 0 10-15-2003 01:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration