Hi,
When I use scp to copy a file from other location, I get the output like filename, time taken etc on console. I want to store that into a database table (in oracle).
Could someone give me some pointers on how to achieve this?
Regards,
Sachin Vaidya
try:
#!/bin/bash
# you need to put the output somewhere: a variable
value=$( scp somefile somewhere: || echo 'NOTOK')
if [ "$value" = "NOTOK" ] ; then
echo 'scp failed'
exit 1
fi
# add single quotes around the text
newval=$(printf "'%s'" "$value")
sqlplus -s user/pswd@instance <<-EOF
insert into mytable
(some_field_name)
values
( $newval );
commit;
EOF
exit