Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

Using ssh with diff

erics_1
Honored Contributor

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
5 REPLIES
Rodney Hills
Honored Contributor

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...
Rodney Hills
Honored Contributor

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...
erics_1
Honored Contributor

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.
Stuart Browne
Honored Contributor

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...
Highlighted
Greg Vaidman
Respected Contributor

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!