Sponsored Content
Top Forums Shell Programming and Scripting How to replace a string to asterisk? Post 302897573 by jim mcnamara on Monday 14th of April 2014 10:09:01 PM
Old 04-14-2014
Also please note:

Unix ps -ef command will show the sqlplus username and password in plain sight, when you run your script that way.

Any other way will require you securing the shell script, but at least the password will not be visible to the ps command. Passwords in a shell script are a security problem. So, if your script is called foo.sh, be sure it resides in a directory that is owned by the same user as the owner of the foo.sh script.

This also requires that the owner is also the uid that runs the script:

Code:
# protect the script
chmod 700 foo.sh

Code:
 
 # foo.sh
   echo "Please enter user name"
   read USERNAME

   echo "Please enter password"
   read PASSWORD

   sqlplus -s $USERNAME/@$HOSTNAME:$PORT/$SERVICE_NAME <<EOF > $OUTFILE
   $PASSWORD
   set verify off
   set serverout on size 100000
   set timing on
   set linesize 120

   select supplemental_log_data_min from v\$database;
   exit;

Note: SET SERVEROUT ON SIZE nnnnn is only used when you call the dbms_output package in pl/sql. Straight sql does not need set serverout on nnnn. And it is not useful without SIZE nnnnn where n is some large number like 99999.
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

2. AIX

Replace string with asterisk(*) in variable

I was trying to replace a string ( for eg - @@asterisk@@ to * ) in variable using cat $INFILE | while read LINE do stmt1=`echo $LINE | sed 's/@@asterisk@@/\*/g'` stmt=$stmt' '$stmt1 stmt2=`echo $LINE` STATEMENT=$STATEMENT' '$stmt2 done echo 'Statement with sed -- > '... (5 Replies)
Discussion started by: Vaddadi
5 Replies

3. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
dsenableroot(8) 					    BSD System Manager's Manual 					   dsenableroot(8)

NAME
dsenableroot -- enables or disables the root account. SYNOPSIS
dsenableroot [-d] [-u username] [-p password] [-r rootPassword] DESCRIPTION
dsenableroot sets the password for the root account if enabling the root user account. Otherwise, if disable [-d] is chosen, the root account passwords are removed and the root user is disabled. A list of flags and their descriptions: -u username Username of a user that has administrative privileges on this computer. -p password Password to use in conjunction with the specified username. If this is not specified, you will be prompted for entry. -r rootPassword Password to be used for the root account. If this is not specified for enabling, you will be prompted for entry. EXAMPLES
-dsenableroot Your username will be used and you will be queried for both your password and the new root password to be set to enable the root account. -dsenableroot -d Your username will be used and you will be queried for only your password to disable the root account. -dsenableroot -u username -p userpassword -r rootpassword The supplied arguments will be used to enable the root account. -dsenableroot -d -u username -p userpassword The supplied arguments will be used to disable the root account. Mac OS August 08 2003 Mac OS
All times are GMT -4. The time now is 11:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy