Sponsored Content
Full Discussion: If condition issue
Top Forums UNIX for Dummies Questions & Answers If condition issue Post 302489820 by methyl on Friday 21st of January 2011 06:01:57 PM
Old 01-21-2011
Belt and braces (and good commercial script technique). Let's change the name of the variable and use braces everywhere. Also make sure we have a space character after "[" and another space character before "]" ... and use a text comparision "=" (not a numeric comparision "-eq") .

Code:
#!/bin/sh
chris1="rerun"
chris2="${1}"

echo "chris1=${chris1}"
echo "chris2=${chris2}"

if [ "${chris1}" = "${chris2}" ]
then
        echo "RERUN"
else
         echo "NOT RERUN"
fi

./test.sh
chris1=rerun
chris2=
NOT RERUN

./test.sh rerun
chris1=rerun
chris2=rerun
RERUN

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

An issue with condition statement in shell script

Hello forum members. please go through the below mentioned issue and let me know the right solution. I have to write a script which runs another script .the executable script take input parmeters.so iam writing the the script below . Sample Code:Begins #! /bin/ksh echo " enter... (2 Replies)
Discussion started by: rajkumar_g
2 Replies

2. Shell Programming and Scripting

if condition issue

Hi, Unix Gurus, I got some issue with my script. #!/usr/bin/ksh while read newstatus do if ; then echo "It is finished " else echo "Not Finished" fi done <checkresult.txt basically, I want to read one file (the file only contains one word, but it dynamically changed),... (2 Replies)
Discussion started by: ken002
2 Replies

3. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

4. Shell Programming and Scripting

Unix and db2 where condition issue(new line)

Hi I am extracting a column value(DESCRIPTION) from one table and passing it to another db2 statement in a shell code to fetch some value(ID) but the value when passed in where condition is taking as newline+value. Please find the out put when executed: + echo description is ::::... (1 Reply)
Discussion started by: msp2244
1 Replies

5. Shell Programming and Scripting

if condition issue

Hi, I have prepared the below shell script for one of the requirement which accesses Informatica application and performs certain functions. But for some reason, if condition fails and scripts stops abruptly with the below error. Please let me know the where the problem is #!/bin/ksh ... (2 Replies)
Discussion started by: svajhala
2 Replies

6. Shell Programming and Scripting

Condition checking issue while if

hi, i am using a simple condition end_ct=`sqlplus -s $ORACLE_USER/$ORACLE_PASS@$ORACLE_SID << EOF select description from bravo_statistics where trunc(time_stamp)=trunc(sysdate)-1 and description='END CAT'; EOF` echo $end_ct; echo... (30 Replies)
Discussion started by: lovelysethii
30 Replies

7. Shell Programming and Scripting

If Condition Issue in UNIX

Hi I am trying to do a "IF" Condition in UNIX where we compare EACH file size in a directory with a SIZE (Parameter passed) If Each File size EXCEEDS parameter passed SIZE then we manipulate the file. Somehow the IF condition do not work ?? (is this Variable decalration issue ??) ... (9 Replies)
Discussion started by: Pete.kriya
9 Replies

8. Shell Programming and Scripting

Issue with IF condition

Getting syntax error when the condition after -o returns more than one file if then echo "Found" fi output: =>ls -l total 5 -rw-rw-r-- 1 wes wes 0 Jun 25 04:51 a.done -rw-rw-r-- 1 wes wes 0 Jun 25 04:51 a.zip -rw-rw-r-- 1 wes wes ... (13 Replies)
Discussion started by: anijan
13 Replies

9. Shell Programming and Scripting

Solaris 11 ksh93 if condition issue

Solaris 11 ksh93 if condition issue Has anyone run into issues with Solaris 11 with ksh93 if condition where it intermittently return wrong return code? We did not see this issue in Solaris 10 with ksh88 Any thoughts? Thanks! Solaris version: SunOS t52-ccc-28 5.11 11.2... (4 Replies)
Discussion started by: nugent
4 Replies

10. Shell Programming and Scripting

Issue with condition "if then elif else fi"

Hi everybody, I must get trought a shell script 3 arguments. 1st argument = $1 (can take values REP1..4) 2nd argument = $2 (can take values A..Z) 3rd arguement = $3 (also can take values A...Z) I've written this code : #!/bin/bash if then liste=/data/folder1 echo... (6 Replies)
Discussion started by: shellX
6 Replies
BPING(1)							  BP executables							  BPING(1)

NAME
bping - Send and receive Bundle Protocol echo bundles. SYNOPSIS
bping [-c count] [-i interval] [-p priority] [-q wait] [-r flags] [-t ttl] srcEID destEID [reporttoEID] DESCRIPTION
bping sends bundles from srcEID to destEID. If the destEID echoes the bundles back (for instance, it is a bpecho endpoint), bping will print the round-trip time. When complete, bping will print statistics before exiting. It is very similar to ping, except it works with the bundle protocol. bping terminates when one of the following happens: it receives the SIGINT signal (Ctrl+C), it receives responses to all of the bundles it sent, or it has sent all count of its bundles and waited wait seconds. EXIT STATUS
These exit statuses are taken from ping. 0 bping has terminated normally, and received responses to all the packets it sent. 1 bping has terminated normally, but it did not receive responses to all the packets it sent. 2 bping has terminated due to an error. Details should be noted in the ion.log log file. FILES
No configuration files are needed. ENVIRONMENT
No environment variables apply. DIAGNOSTICS
Diagnostic messages produced by bping are written to the ION log file ion.log and printed to standard error. Diagnostic messages that don't cause bping to terminate indicate a failure parsing an echo response bundle. This means that destEID isn't an echo endpoint: it's responding with some other bundle message of an unexpected format. Can't attach to BP. bpadmin has not yet initialized Bundle Protocol operations. Can't open own endpoint. Another application has already opened ownEndpointId. Terminate that application and rerun. bping bundle reception failed. BP system error. Check for earlier diagnostic messages describing the cause of the error; correct problem and rerun. No space for ZCO extent. ION system error. Check for earlier diagnostic messages describing the cause of the error; correct problem and rerun. Can't create ZCO. ION system error. Check for earlier diagnostic messages describing the cause of the error; correct problem and rerun. bping can't send echo bundle. BP system error. Check for earlier diagnostic messages describing the cause of the error; correct problem and rerun. BUGS
Report bugs to <ion-bugs@korgano.eecs.ohiou.edu> SEE ALSO
bpecho(1), bptrace(1), bpadmin(1), bp(3), ping(8) perl v5.14.2 2012-05-25 BPING(1)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy