Unix Shell - Is it possible to diff $variable1 $variable2?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > October 2006 > Is it possible to diff $variable1 $variable2?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Is it possible to diff $variable1 $variable2?
Dundonald

2006-10-24, 1:17 pm

Is it possible to diff $variable1 $variable2?

The content of variable1 and variable2 is the result of a few commands
on the content of files. So rather than putting the output of
processing those files to temporary files just to perform the diff I
figured I'd ask if the above was possible.

I've tried:

diff `echo "$variable1"` `echo "$variable2"`

with no luck.

Radoulov, Dimitre

2006-10-24, 1:17 pm

> Is it possible to diff $variable1 $variable2?
>
> The content of variable1 and variable2 is the result of a few commands
> on the content of files. So rather than putting the output of
> processing those files to temporary files just to perform the diff I
> figured I'd ask if the above was possible.
>
> I've tried:
>
> diff `echo "$variable1"` `echo "$variable2"`


$ echo "$var1"
pippo
pluto

$ echo "$var2"
pippo1
pluto

$ diff <(echo "$var1") <(echo "$var2")
1c1
< pippo
---
> pippo1



Regards
Dimitre


Dundonald

2006-10-24, 1:17 pm


Radoulov, Dimitre wrote:
[vbcol=seagreen]
>
> $ echo "$var1"
> pippo
> pluto
>
> $ echo "$var2"
> pippo1
> pluto
>
> $ diff <(echo "$var1") <(echo "$var2")
> 1c1
> < pippo
> ---

Thanks Dimitre.

Bill Marcum

2006-10-25, 1:32 am

On 24 Oct 2006 08:08:32 -0700, Dundonald
<mark.dundon@gmail.com> wrote:
> Is it possible to diff $variable1 $variable2?
>
> The content of variable1 and variable2 is the result of a few commands
> on the content of files. So rather than putting the output of
> processing those files to temporary files just to perform the diff I
> figured I'd ask if the above was possible.
>
> I've tried:
>
> diff `echo "$variable1"` `echo "$variable2"`
>

diff <(echo "$variable1") <(echo "$variable2")



--
Man's reach must exceed his grasp, for why else the heavens?
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com