Bourne Shell SSH/FTP



In a Bourne shell script, I'd like to use ssh to execute a command on
a remote host. The command I'd like to execute is a FTP command.
Here's what I'd like to do:

#
# scp a file to the host so it's there
#
scp file username@host /directory/file

#
# Using ssh, ftp the file from the host to host2
#
ssh username@host <<SSH
cd /some-directory
ftp username@host2 <<FTP
put filename
FTP_END
#
# Remove the file from host (clean up work)
#
SSH_END

continue to do some clean-up

end the script

I know this is possible, but is there information on this somewhere?
I'm just guessing about all this. I know it works, but there are
things that don't work, and I don't know why? For example, after the
SSH_END nothing else in the script will run, and I don't know why?
.



Relevant Pages

  • Re: SYSCONF and FTPIT jobs
    ... belonging to the 192.168/16 netblock and is connected to the ftp host via ... I also have concerns about the generated ftpin file. ... 200 PORT command successful. ...
    (comp.sys.hp.mpe)
  • Re: LWP::Simple getstore with absolute path not working
    ... That's how FTP URIs are supposed to work. ... | argument to a CWD command. ... Connect to host and log in as anonymous. ...
    (comp.lang.perl.misc)
  • RE: midnight commander and ssh sftp
    ... midnight commander and ssh sftp ... which is displayed at the bottom of the MC panel. ... "Left file command options right" at the top of the MC ... MC SSH session with the remote host by hitting F10 key. ...
    (freebsd-questions)
  • maven/ant and ssh/exec - missing or ill-formed stdout
    ... on a remote unix host. ... The command is fired off ok but the stdout from the command is ill ... If I run the commands on the remote host (without ssh) it works fine. ...
    (comp.lang.java.programmer)
  • Re: open failed: connect failed: Connection refused
    ... >> That means running an ssh command on the inside host, ... >> an SSH server on the outside host. ...
    (comp.security.ssh)