Meaning of this line in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Meaning of this line in script
# 1  
Old 01-22-2009
Meaning of this line in script

Can anyone explain me the meaning of line #2 in these lines of shell script:

if [ "${PMON}" == "yes" ] ; then
${EXPR} " ${MACTIONS[*]} " : ".* ${ACTION} " >/dev/null 2>&1 || die "$USAGE"
else

Sorry in case this is a trivial thing (I am not an expert in this).
# 2  
Old 01-22-2009
Translated roughly :
if variable PMON holds value 'yes', then execute the following : variables that do something, and : the first part, "> /dev/null" means send standard output away. The second part, "2>&1" means "redirect standard error (2) to the same place as standard output (1.) OR finish the execution of the script with printing the USAGE message.
# 3  
Old 01-22-2009
I particularly want to know the meaning of colon : and .* in the line. Can you pls explain ?
# 4  
Old 01-22-2009
Easiest thing to do is echo the line to see how it's expanded by the script, so just mod your program to...

Code:
if [ "${PMON}" == "yes" ] ; then
echo ${EXPR} " ${MACTIONS[*]} " : ".* ${ACTION} " 
${EXPR} " ${MACTIONS[*]} " : ".* ${ACTION} " >/dev/null 2>&1 || die "$USAGE"
else

and see what you get, but : is a 'null command' that always returns success and is used as a comment identifier.

Jerry
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Meaning of =~ in shell script

Please let me understand the meaning of following line in unix bash scripting .is =~ means not equal to or equal to . if ]; then echo -e "pmcmd startworkflow -sv ${INTSERV} -d ${INFA_DEFAULT_DOMAIN} -uv INFA_DEFAULT_DOMAIN_USER" \ "-pv INFA_DEFAULT_DOMAIN_PASSWORD -usdv... (2 Replies)
Discussion started by: harry00514
2 Replies

2. Shell Programming and Scripting

What is the meaning of ## in UNIX shell script?

Hi All, I am new to unix shell scripting and I was documenting one of the unix script and encountered below statements - for ii in `ls -1rt /oracle/admin/MARSCOPY/ext_files/fpm-ifpm/*.small.txt | tail -1 | awk '{print $1}'` do smallssim=${ii##/oracle/admin/MARSCOPY/ext_files/fpm-ifpm/}... (2 Replies)
Discussion started by: shuklajayb4
2 Replies

3. UNIX for Dummies Questions & Answers

What is meaning of given line?

Hello Guys, I was study some links, where I was unable to understand below line, please enhance me these code. (3 Replies)
Discussion started by: aaditya321
3 Replies

4. UNIX for Dummies Questions & Answers

UNIX Script - snipet meaning?

What would the below code snippet mean? my ($_configParam, $_paramValue) = split(/\s*=\s*/, $_, 2); $configParamHash{$_configParam} = $_paramValue; (2 Replies)
Discussion started by: MaKha
2 Replies

5. UNIX for Dummies Questions & Answers

Meaning of awk script

what does this mean? awk '!a||a>$1 {a=$1} END {for (i in a) print a,i}' file (6 Replies)
Discussion started by: osama ahmed
6 Replies

6. UNIX for Dummies Questions & Answers

Meaning of script with echo, -d, -f1, -f2

Hello Friends, I am a new learner of Unix & need to understand below script as start up, Can anyone explain the meaning of each line listed below. Thanks for your time. #!/usr/bin/ksh PARAMS=$1 #echo "parms passed is $PARAMS @" STATUS=`echo ${PARAMS} | cut -d: -f1` JOBNAME=`echo... (9 Replies)
Discussion started by: DK2014
9 Replies

7. Shell Programming and Scripting

Whats the meaning of set -e inside the script

Hi, I would like to ask about the meaning or purpose of set -e in the script bash, Does it mean if a wrong command in the script it will close or exit the script without continuation thats what happen if i set it in the terminal. Thanks in advance (3 Replies)
Discussion started by: jao_madn
3 Replies

8. UNIX for Dummies Questions & Answers

meaning of script

hello every one i want to know meaning of following line INST_PARA=$HOME/install/Install.Para SAVEMEDIUM=`awk '$2=="ArchiveSave"{print$4}' $INST_PARA` (4 Replies)
Discussion started by: kaydream
4 Replies

9. Shell Programming and Scripting

Want to understand the meaning of the following line

HI All Please find the code below from a script called test.sh echo "Hello World" . test_common.lib get_info in the file test_common.lib i have the following contents get_info() { c_cnt=0; cm=""; echo "Inside get_info" } when i run the script test.sh ... (5 Replies)
Discussion started by: dhanamurthy
5 Replies

10. Shell Programming and Scripting

What is the meaning of "tab" in script ?

Hi, GOD bless you every body I have some script to compile a COBOL program - listed bellow - I have many questions about the syntax of this script: 1- There is many "tab" in the script, what does it means? Note: the tab is invisible, so I have colored it into red. 2- The "rm" command is... (3 Replies)
Discussion started by: so_friendly
3 Replies
Login or Register to Ask a Question