Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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.
Thanks,
Nyati

Regarding your sftp question: The expect utility is good for automating interactive programs. See this thread:
http://www.computing.net/unix/wwwboard/forum/6642.html
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:
#!/bin/ksh
# This function pipes a date time string of the format:
# YYYY MM DD HH MM SS
# 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

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |