Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

diff between variable

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
AU
Hi guys,

Just wondering how to diff between two variable

example:
Code:
a=`ls dir1`
b=`ls dir2`

diff $a $b --> wont work

Do you know how to do that ? or diff only work for files only ?
 
Yes - only for files, so:

ls dir1 >/tmp/lsdir1$$
ls dir2 >/tmp/lsdir2$$

diff /tmp/lsdir1$$ /tmp/lsdir2$$

rm /tmp/lsdir1$$
rm /tmp/lsdir2$$

(the $$ adds the current process' PID to the filenames, so the files are unique enough)


HTH,

p5wizard
 
On most versions of Unix you can simply do
Code:
diff dir1 dir2
Tested on RedHat Linux and AIX 4.3

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top