Hi,
I tried out the following and am getting errors for the one on Micro$oft. Any chance of any monks telling me what am I doing wrong.
The original sugggested code is as below:
open my $bash, "|-", "bash >/tmp/out.txt" or die $!;
print $bash <<EOL;
ls
df -h
uname -a
EOL
I took out the |- and "bash ..." because I want to be able to do this for both Unix and Windows. I assume you cannot do |-
on Windows, is that a correct assumption? If anyone can please tell me why am getting the error for the sqlplus under DOS:,
it will be very much appreciated. Thanks in advance.
Codes below, all is working except for sqlplus under DOS.
DOS:
OS Command - works OK:
open(OUTPUT, " > eol_dos.out") or die $!;
print OUTPUT <<`EOL`;
dir
EOL
exit 0;
sqlplus - this gives error : << was unexpected at this time.
$ENV{'ORACLE_SID'}="TEST";
$ENV{'ORACLE_HOME'}="C:\oracle\product\10.2.0";
open(OUTPUT, " > eol_sqlplus_dos.out") or die $!;
print OUTPUT <<`EOL`;
sqlplus -S "/as sysdba" <<"SQLEND"
set heading off
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'
;
select 'Connected to the database on ' || sysdate
from dual
;
SQLEND
EOL
exit 0
UNIX:
OS Command - works OK:
open(OUTPUT, " > eol_unix.out") or die $!;
print OUTPUT <<`EOL`;
ls
echo
echo "+----------------------------------------------+"
echo
df
echo
echo "+----------------------------------------------+"
echo
uname -a
EOL
exit 0;
sqlplus - works OK:
$ENV{'ORACLE_SID'}="test";
$ENV{'ORACLE_HOME'}="/oracle/product/10.2.0";
open(OUTPUT, " > eol_sqlplus_unix_02.out") or die $!;
print OUTPUT <<`EOL`;
echo "Today is `date`"
echo
echo "+----------------------------------------------+"
echo
sqlplus -S "/as sysdba" <<"SQLEND"
set heading off
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'
;
select 'Connected to the database on ' || sysdate
from dual
;
SQLEND
echo
echo "+----------------------------------------------+"
echo
EOL
exit 0
|