Sponsored Content
Top Forums Shell Programming and Scripting Help to understand the script Post 302480341 by citaylor on Tuesday 14th of December 2010 03:08:36 PM
Old 12-14-2010
Code:
# If the user hits Control-C this line of script will be run.  
# My guess is the C_logmsg script function will log the below message somewhere, 
# and then the script will terminate with return code 1
trap 'C_logmsg "F" "CNTL/c OS signal trapped, Script ${G_SCRIPTNAME] terminated"; exit 1' 2
# If the script has a TERMINATE signal sent to it (usually when machines shutdown, etc
# the below line will again log a message using C_logmsg and exit with code 1
trap 'C_logmsg "F" "Kill Job Event sent from the Console, Script ${G_SCRIPTNAME] terminated"; exit 1' 15
#----------------------------------------------------------------------------------------------
# If the shell variable $DEBUG is set...
if [${DEBUG} ]; then
# The shell will turn on its internal debug and verbosity, displaying lots of messages
# to the user who runs the script.
set -xv; # Verbose Trace
fi
# Set the variable DOC_SCRIPTS to the string value of the contents of
# the variable $CONTROL_BASE with "/scripts" concatenated on the end.
# For example if CONTROL_BASE="/home/user1" then
# DOC_SCRIPTS would now equal "/home/user1/scripts"
typeset DOC_SCRIPTS=${CONTROL_BASE}/scripts
# Set the variable DOC_ARCHIVE to the string value of the contents of
# the variable $FileNet with "/archive" concatenated on the end
typeset DOC_ARCHIVE=${FileNet}/archive
# Set the variable DOC_SSI to the string value of the contents of
# the variable $CONTROL_BASE with "/ssi" concatenated on the end
typeset DOC_SSI=${CONTROL_BASE}/ssi
# Change the current working directory to the value of the contents of
# the variable $DOC_SCRIPTS.
cd ${DOC_SCRIPTS}
# Split the value of the contents of the variable $CONTROL_BASE into
# pieces delimited by the character "/" and place the 4th value into the variable
# DOC_LEVEL.  For example if $CONTROL_BASE="a/b/c/d/e" then
# DOC_LEVEL would equal "d"
typeset DOC_LEVEL=`echo ${CONTROL_BASE}|cut -d/ -f4`
# "source" the script located in the file denoted by the contents of the 
# values of the variables below. Sourcing a file is slightly different from running
# a script in that it will keep all the values of variables and functions defined within
# the new script.  This does not happen if the script is simply run.
. ${DOC_SSI}/DCS_${DOC_LEVEL}01_${HOSTNAME}.ssi
# "source" the script located in the file denoted by the contents of the 
# values of the variables below. 
. /cm/vgi/etc/ssi/DCS_${DOC_LEVEL}01_${HOSTNAME}_secure.ssi.v1

I hope this is clearer...
This User Gave Thanks to citaylor For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help wanted to understand MQ script

hi , i am writing a script to copy the MQ messages from onw queue to another. The following i got from one site, but i di not understand , can anyone explain. /root/scripts/sap/q -m$Q_MANAGER -i$Q_NAME_SRC_1 -F/logs/mq/MQ_COPYdump_$Q_NAME_SRC_1.$$ /root/scripts/sap/q -m$Q_MANAGER... (0 Replies)
Discussion started by: Satyak
0 Replies

2. Shell Programming and Scripting

Can't understand the script

I am relatively new to Shell Scripting. I can't understand the following two scripts. Can someone please spare a minute to explain? 1) content s of file a are (021) 654-1234 sed 's/(//g;s/)//g;s/ /-/g' a 021-654-1234 2)cut -d: -f1,3,7 /etc/passwd |sort -t: +1n gives error (3 Replies)
Discussion started by: shahdharmit
3 Replies

3. Shell Programming and Scripting

Need to understand the script pls help

Can u please explain what it is doing #!/bin/sh fullyear=`/home/local/bin/datemmdd 1`"."`date +%Y` uehist=/u05/home/celldba/utility/ue/prod/history echo $fullyear cd $uehist ls -ltr pwroutages.master.$fullyear* | awk '{print $9}' > /u01/home/celldba/tmp/pwroutages_master_all_tmp while... (2 Replies)
Discussion started by: raopatwari
2 Replies

4. Shell Programming and Scripting

Need help to understand ksh script

Hi All, I have a ksh script & would like to understand mening of below lines in script, Starting lines of script is as below, #!/bin/ksh #%W% %I% %D% %T% ---- ??? #%W%G --- ??? num_ctrl_files=0 OS=`uname` if then //g' | egrep -v '(.sh:|.ksh:)' | sed 's/^.*://g' | sed 's/^M//g' |... (6 Replies)
Discussion started by: gr8_usk
6 Replies

5. Shell Programming and Scripting

Understand script formte

Hi i have one script and i am running it but not getting current output so i want to understand how to input in the script. when i do help then i am getting below massage thanks got it (1 Reply)
Discussion started by: asavaliya
1 Replies

6. Shell Programming and Scripting

Help to understand a script

Hello world! Can someone please explain me how this code works? I'ts supposed to find words in a dictionary and show the anagrams of the words. { part = word2key($1) data = $1 } function word2key(word, a, i, x, result) { x = split(word, a, "") asort(a) ... (1 Reply)
Discussion started by: jose2802
1 Replies

7. Shell Programming and Scripting

Can't understand script output

New to korn shel1 and having an issue. The following is suppose to read the parameter values from files in a source directory and then pass them on to a log file in a different directory, The ArchiveTracker scripts is suppose to call the parameterreader script to exact the parameter values and... (3 Replies)
Discussion started by: bayouprophet
3 Replies

8. Shell Programming and Scripting

Need help to understand the below shell script

Please help me to understand the below 3 lines of code.execute shell in jenkins 1)APP_IP=$( docker inspect --format '{{ .NetworkSettings.Networks.'"$DOCKER_NETWORK_NAME"'.IPAddress }}' ${PROJECT_NAME_KEY}"-CI" ) 2)HOST_WORKSPACE=$(echo ${WORKSPACE} | sed... (1 Reply)
Discussion started by: naresh85
1 Replies

9. UNIX for Beginners Questions & Answers

Help me understand this script

#!/bin/awk -f BEGIN {i=1;file="modified.txt"} { if ($0 !~ /^DS:/) {print $0 >> file} else { if ($0 ~ /^DS:/) {print "DS: ",i >> file;if (i==8) {i=1} else {i++}}; } } END {gzip file} Can someone explain to me how this above script works, I got it from a friend but not able... (3 Replies)
Discussion started by: Kamesh G
3 Replies
exit(1)                                                            User Commands                                                           exit(1)

NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps SYNOPSIS
sh exit [n] return [n] csh exit [ ( expr )] goto label ksh *exit [n] *return [n] DESCRIPTION
sh exit will cause the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of the last command executed (an EOF will also cause the shell to exit.) return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe- cuted. csh exit will cause the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the expression expr. The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to jump to a label that occurs between a while or for built-in command and its corresponding end. ksh exit will cause the calling shell or shell script to exit with the exit status specified by n. The value will be the least significant 8 bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file will also cause the shell to exit except for a shell which has the ignoreeof option (See set below) turned on. return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value will be the least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return is invoked while not in a function or a '.' script, then it is the same as an exit. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
break(1), csh(1), ksh(1), sh(1), attributes(5) SunOS 5.10 15 Apr 1994 exit(1)
All times are GMT -4. The time now is 01:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy