1833059 Members
2626 Online
110049 Solutions
New Discussion

shell

 
SOLVED
Go to solution
Aggy
Frequent Advisor

shell

first lines in the file. I didn't understand the . Is it reading from variables or putting values in them. What does -u8 stand for ? I think it is putting in values into the variables 'cause apps.pswd has three lines - first line has user name , secnd has it's password and third has the database name for logging into Oracle.
And if $1,$2,$3 are not there, where did $4 come from ?


exec 8< $APPL_TOP/custom/security/apps.pswd
read -u8 first_line
read -u8 second_line
read -u8 third_line

# Concurrent request id
CONREQ=$4

#sqlplus $UserPass @$INVC_TOP/sql/MMRE_POC_GEN $CONREQ
sqlplus $first_line/$second_line@$third_line @$INVC_TOP/sql/MESG_POC_GEN $CONREQ
6 REPLIES 6
Andreas Voss
Honored Contributor
Solution

Re: shell

Hi,

when a line begins with . the following command (script) is executed within the shell (without . it's executed in a subshell) so that ie. exported varaiables are known to the shell.
The exec <8 $APPL_TOP/custom/security/apps.pswd
opens an input file descriptor 8 (standard file descriptors are: 0=stdin, 1=stdout, 2=stderr) from the file $APPL_TOP/custom/security/apps.pswd
The read -u8 .... then reads it's input from file descriptor 8.
In my opinnion the $4 must come as the commandline parameter 4 of the shell script.

Regards
James R. Ferguson
Acclaimed Contributor

Re: shell

Hi:

The '-u' option of the read command specifies the file descriptor from which to read. In this case, that is '8' as opened by the 'exec' command. Normally a 'read' would gather data from descriptor-0 (stdin).

...JRF...
Ralph Grothe
Honored Contributor

Re: shell

It says in the sh-posix manpage that the flag -u designates a file descriptor to read from that typically is opened with the exec command.
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: shell

It says in the sh-posix manpage that the flag -u designates a file descriptor to read from that typically is opened with the exec command.
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: shell

Sorry for the repost,
the webserver once again was misdemeaning
Madness, thy name is system administration
Alan Riggs
Honored Contributor

Re: shell

Andreas nailed it (surprise!)

u8 indicates the file descriptor 8, which has been set to your apps file.

$4 indicates the fourth positional parameter passed to the script from the command line.