Re: Using ssh with diff (221 Views)
Reply
Honored Contributor
erics_1
Posts: 445
Registered: ‎02-22-2001
Message 1 of 6 (221 Views)

Using ssh with diff

All,

I have existing scripts on a sco system here that pull and push files to a dmz'd ftp server. I'm moving the scripts to an hp 11.11 box and have syntax problems with one of the lines:

`diff -b <(ssh dmz_host ls -l /path/to/user/from) <(ls -l /path/to/user/outgoing)>/dev/null`


This command compares the the output of listing both the remote dir. and local dir. I've tried various combinations but can get nothing to work. What am I missing?

Thanks,
Eric
Honored Contributor
Rodney Hills
Posts: 1,679
Registered: ‎09-09-1996
Message 2 of 6 (221 Views)

Re: Using ssh with diff

Not to be unkind, but that command is so wrong at so many levels.

Usually I would copy the listings locally, then do the diff. Example-

ssh dms_host ls -l /path/to/user/from >/tmp/temp1
ls -l1 /path/to/user/outgoing >/tmp/temp2
diff -b /tmp/temp1 /tmp/temp2

HTH

-- Rod Hills
There be dragons...
Honored Contributor
Rodney Hills
Posts: 1,679
Registered: ‎09-09-1996
Message 3 of 6 (221 Views)

Re: Using ssh with diff

A better tool for keeping/checking that two file structures are in sync is called "rsync". It can work with "ssh" and it has many nice features.

Here is the link to the software porting and archive center-
http://hpux.cs.utah.edu/hppd/hpux/Networking/Admin/rsync-2.6.4/

HTH

-- Rod Hills
There be dragons...
Honored Contributor
erics_1
Posts: 445
Registered: ‎02-22-2001
Message 4 of 6 (221 Views)

Re: Using ssh with diff

Rodney,

Maybe we can skip the critical opinions in the future? I didn't post the whole script because there wasn't a need to. I'm using rsync with ssh to pull files from a dmz server. rsync does not handle partial files well and there's a real potential with that in this case.

Thanks again.
Honored Contributor
Stuart Browne
Posts: 3,032
Registered: ‎02-20-2002
Message 5 of 6 (221 Views)

Re: Using ssh with diff

Just wondering, what shell is this being run under?

It certainly is a novel way to use <() handles :) But I wasn't aware that it existed in shells other than 'bash'.
One long-haired git at your service...
Respected Contributor
Greg Vaidman
Posts: 252
Registered: ‎09-12-2000
Message 6 of 6 (221 Views)

Re: Using ssh with diff

Eric,
The <() syntax you're using is for the bash shell - see http://www.gnu.org/software/bash/manual/bashref.html#SEC32 for what this syntax means.

Rather than trying to fix the syntax, you could just get bash for HP-UX, at any of the following locations:

-> (11i v1 only) Linux Porting Kit - http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B9891AA

-> (11i v2 only) Internet Express - http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXIEXP1123

-> (all versions 11i) HP-UX Porting Archive - http://hpux.connect.org.uk/hppd/hpux/Shells/bash-3.00.16/

Good luck!
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.