ksh Syntex for elif conditions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh Syntex for elif conditions
# 1  
Old 08-14-2017
Wrench ksh Syntex for elif conditions

Hi,
Please help here for below are the correct syntax or not for elif for korn shell.
Code:
if [ $gg -gt 0 ] && [ $T -gt 0 ] && [ $T1 -gt 0 ] && [ $T2 -gt 0 ] ; then
   echo "ALL Servers are Running"
elif [ $gg -eq 0 ] ; then
   echo "gg Not Running"
fi


Last edited by vbe; 08-14-2017 at 08:07 AM.. Reason: code tags missing
# 2  
Old 08-14-2017
What happens if you run it, eventually with the xtrace (-x) option set?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If / elif

Hello all, I have a scenario where I take user input values and accordingly take actions say I run a script with sh scriptname -x GB -e txt (txt can also be text) I have used if clause for the first input (-x GB)and it is working fine Now for second the scenario is if then echo... (3 Replies)
Discussion started by: nnani
3 Replies

2. Shell Programming and Scripting

Errors in if conditions with to many OR conditions

Hi ALL I have a script where in i need to check for several values in if conditons but when i execute the script it throws error such as "TOO MANY ARGUMENTS" if then msg="BM VAR Issue :: bmaRequestVAR=$bmaRequestVAR , nltBMVAR=$nltBMVAR , bmaResponseVAR=$bmaResponseVAR ,... (10 Replies)
Discussion started by: nikhil jain
10 Replies

3. UNIX for Advanced & Expert Users

if else elif

Hi all,i have configured the following script to check if the file exists or not, #!/bin/sh sleep 30 { FILEFULL=$1`date +$2`* if ; then echo $FILEFULL exist else echo "$FILEFULL File not Found" | mail -s 'server' myaccount@mydomain.com fi } but i have a problem, i need to... (2 Replies)
Discussion started by: charli1
2 Replies

4. Shell Programming and Scripting

Expr Syntex error

Hello, I am new to Shell programing. I want to add two numbers & show result. command I use are as under Echo Enter the two numbers read number d1 = ` expr $ num%10` num = `expr $ num/10` d2 = ` expr $ num%10` num = `expr $ num/10` sum = $ d1 + $ d2 echo the sum is $ sum I am getting... (1 Reply)
Discussion started by: pbchhaya
1 Replies

5. Shell Programming and Scripting

Multiple indexed conditions with ksh

Dear Unix Experts, I have randomly generated the x, y, and z coordinates of 16 atoms of two species, A and B (8 atoms each) Then I calculated the spacing between all the A atoms labeled d1, B atoms labeled d2 and between A and B atoms labeled d3. I would like to save the x, y, z coordinates to... (1 Reply)
Discussion started by: vahid
1 Replies

6. Homework & Coursework Questions

if/elif help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This is my problem for the class. Write a script that asks for the user's age. If it is equal to or higher... (6 Replies)
Discussion started by: aggie6970
6 Replies

7. UNIX for Dummies Questions & Answers

Help with ELIF statement

I am receiving an elif error on line 13 and I can not figure out the reasoning behind it. I have added the then statement that I was initially missing. Any help would be great. #The purpose of this script is for the end user to be able to enter a positive number #User enters a number NUM=$1... (4 Replies)
Discussion started by: Brewer27
4 Replies

8. Shell Programming and Scripting

syntex error script any suggestions

a script with prompts user and returns the value of there home directory and full name #!/bin/bash echo "please enter your login ID" read login_id while $login_id -ne `grep $login_id /etc/passwd | cut -f1 -d:` is they anything wrong with it (5 Replies)
Discussion started by: kim187
5 Replies

9. Shell Programming and Scripting

If..elif..else...fi

Hi all, I got some problems on executing the following scripts. Scripts: if ]; then echo "M${str}O 0 1" >> ${tempFile} elif ]; then echo "M${str}O 1 0" >> ${tempFile} else echo "M${str}O 0 0" >> ${tempFile} fi Error: "`;' is not expected." what's the problem? (2 Replies)
Discussion started by: Rock
2 Replies

10. Shell Programming and Scripting

syntex error

hi I am try to run following script using c-shell but i get the following syntex error:- ----script--- --------------------------------------------------------------------------------- #!/bin/csh echo "system monitor" echo " 1) system paging 2) system file inf. 3) system... (1 Reply)
Discussion started by: neer45
1 Replies
Login or Register to Ask a Question