Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell Script

Status
Not open for further replies.

greju

Programmer
Oct 20, 2003
7
US
This is regarding the script tunrestore in AIX 5.2
From Line 323 onwards we find the following script...

for (i=1; i<=NB_STANZAS; i++) {
xxo = STANZAS
cmd = (DSPMSG &quot; -s &quot; MSGSET &quot; &quot; MSGCAT &quot; 20 \&quot;Restoring %1\\$s values\n\&quot; &quot; xxo)
cmd | getline msg
close(cmd)
print msg >> LOGFILE
gsub(&quot;.&quot;,&quot;=&quot;,msg)
print msg >> LOGFILE
arg = ARGS[xxo]
if (arg != &quot;&quot;) {
system(CMDDIR &quot;/&quot; xxo &quot; &quot; arg &quot; >> &quot; LOGFILE &quot; 2>&1&quot;)
}

I would like to know what does the line &quot;cmd | getline msg&quot; mean. I just know that something is being written to msg but what is this statement doing exactly ?
 
Without knowing what the variables in this line are :
cmd = (DSPMSG &quot; -s &quot; MSGSET &quot; &quot; MSGCAT &quot; 20 \&quot;Restoring %1\\$s values\n\&quot; &quot; xxo)
it's difficult to say. But - consider this :
&quot;date +\&quot;%d %m %Y\&quot;&quot; | getline datestr
The variable datestr contains the result of the date command
eg 27 10 2003
HTH

Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top