Skip to content
CA Process Automation - 4.2.2
Documentation powered by DocOps

UNIX Script Example: UNIXGetInfo Script Operator

Last update January 12, 2015

The UNIXGetInfo operator runs UNIX script on a UNIX touchpoint.

The UNIX script example creates two indexed fields, HostList and OSList in the UnixGetInfo operator dataset. It reads the source file line-by-line and assigns host names ($host) to indexed values in sequential HostList fields and operating systems ($opsys) to indexed values in sequentially numbered OSList fields, starting with 0, and finishing at one less than the number of rows read from the source file.

The UNIX Shell script parameter variables $1, $2, etc. are set by the first, second, etc., entries of the Parameters input area of the calling Run Script operator. In this case, only one parameter is being passed, which is used to set SourceFile. The number of rows read are assigned to the operator dataset variable named NumRowsRead. The sleep 30 line has no purpose other than to pause the operator and give the user 30 seconds to examine the folders and files created in the C2OSVD location. This line would not be included in a production script.



#known to be reading 2 variables, host and operating system

mkdir $C2OSVD/HostList

mkdir $C2OSVD/OSList

integer counter=0

while read host opsys; do

    echo -n $host > $C2OSVD/HostList/${counter} 

    echo -n $opsys > $C2OSVD/OSList/${counter}  


done < $SourceFile

echo -n $counter > $C2OSVD/NumRowsRead

sleep 30

exit 0

Was this helpful?

Please log in to post comments.