1

I have a Pro*C program which I run on Unix server a but the input file required for this program is on other Unix server b. Whenever I run I have to copy the file from server b to a.

Is there any way that I can access the file from other server while running the program to give file name as the whole path which is on server b

2

If your OS supports FUSE, you can use SSHFS to mount a remote directory to a local one.

Otherwise, assuming your shell is bash, you can still do it like this:

program <(ssh b 'cat /path/to/file')

But this only works if your program only wants to read from the file on machine b.

  • i am using ksh, will it work in the ksh – Aravind May 5 '15 at 10:44
  • No, ksh doesn't support <(...) constructs (at least as far as I remember). – lcd047 May 5 '15 at 11:13
  • I think ksh invented <(…) (like most post-Bourne shell programming constructs). It dates back from before ksh93, but it wasn't added to pdksh. @Aravind – Gilles 'SO- stop being evil' May 5 '15 at 23:26
0

Assuming your shell is Bash, you can do it like this:

ssh user@hostname.com "cat -f /path/to/file"
  • or if the program can read from STDIN run ssh to get the file and pipe it to the program – Skaperen May 5 '15 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.