For Programmers: Free Programming Magazines  


Home > Archive > Unix Shell Programming > 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-30, 7:14 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-30, 7:14 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-30, 7:14 pm


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

Thanks Dimitre.

Bill Marcum

2006-10-30, 7:14 pm

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







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com