Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> c-shell: use of << EOF and piping

c-shell: use of << EOF and piping

From: Ben Moretti <crung_at_cobweb.com.au>
Date: 1998/04/25
Message-ID: <crung-2504981607480001@p166.cobweb.com.au>#1/1

Howdy,

background: my workplace has a very large unix system with multiple databases and applications centred on mining production and exploration data. part of what i do is to run a series of batch data extract and format jobs, which are written in pl/sql but driven by c-shell scripts on solaris 2.5 (i think).

the problem: part of the multiuser environment is *hiding passwords*. this has been achieved in the past by storing the password of the rdbms in a file with very tight unix permissions that are called as per the example below. however, if sneaky users do a ps -aef | grep <username> they can see the the password displayed.

sqlplus `cat password_file` @select_script.sql $1 $VARIABLE | awk '/ORA-/||/PLS-/||/PL\/SQL:/' > select.log

(the above should all be on one line) as you can see from the above example, i:

  1. call sqlplus
  2. cat the password file and pass it to sqlplus
  3. call the sql script
  4. pass two variables to it
  5. pipe this into an awk which grabs a string and puts it in a logfile

this works very well, but i come up with the password snooping problem outlined above.

the obvious solution is to use "<< EOF" as follows:

sqlplus << EOF
username/password
@select_script.sql $1 $VARIABLE

EOF which works. however, i *must* be able to pipe the output to

awk '/ORA-/||/PLS-/||/PL\/SQL:/' > select.log

and the obvious solution of

sqlplus << EOF
username/password
@select_script.sql $1 $VARIABLE

EOF | awk '/ORA-/||/PLS-/||/PL\/SQL:/' > select.log

does not work. i suppose i could write it to a temp file or something and then cat that for awk, but that's not the point is it?

if anyone has any suggestions....

cheers

ben Received on Sat Apr 25 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US