sftp unix script

June 6, 2006 at 08:26:28
Specs: unix, intel
I have created a script in unix and that needs to be automated. The script spools some.csv files from oracle and then I have to sftp the files. I have to only use sftp because of security reasons. I tried to sftp the files...but the problem is that sftp cannot be automated beacuse it prompts for apssword. I am running .ksh on sun box.

please reply as soon as possible. Also if i were to use perl script could i enclose perl script in .ksh script. If so, please send an example.


See More: sftp unix script

Report •

June 6, 2006 at 09:09:19
Regarding your sftp question: The expect utility is good for automating interactive programs. See this thread:


Regarding your perl question: I'm not sure what you are asking. Perl can be embedded in a ksh script just like any unix tool. Take a look at this example:


# This function pipes a date time string of the format:
# to perl which autosplits the string and uses timelocal to return
# the number of seconds from the Epoch.
# No error checking!
function get_epoch_seconds {
echo $*| perl -MTime::Local -ane '
my $epochseconds = timelocal($F[5], $F[4], $F[3], $F[2], $F[1] - 1, $F[0]);
print "$epochseconds\n"; '

nosecs=$(get_epoch_seconds 2005 11 23 18 19 30)
echo $nosecs

Report •
Related Solutions

Ask Question