How to redirect the output of below command in shell into logfile.
sqlplus -s "/nolog" <<EOF
conn / as sysdba
@?/sqlpatch/19282021/postinstall.sql
exit;
EOF
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityJust use redirection operator >
at the first line:
sqlplus -s "/nolog" <<EOF >logfile
conn / as sysdba
@?/sqlpatch/19282021/postinstall.sql
exit;
EOF
You can also write >logfile
at the beginning of the line, what is equally legal syntax in most shells, but less commonly practiced.
>logfile sqlplus -s "/nolog" <<EOF
conn / as sysdba
@?/sqlpatch/19282021/postinstall.sql
exit;
EOF
sqlplus >logfile -s
etc.
cat file >file
doesn't work as expected - shell first redirect the output to file
(and in the process truncate the file) and only then goes back to cat
, but at this point cat
reads only empty file.