04-23-2002
multiple conditions in if statements
Hi all, I'm confused about the proper syntax for multi-conditional if then statements. I'm trying to set limitations on info input on the command line.. i.e.
if [$x=[+|-|/|*|%]] ;then
$x=$vr1
else
print "You have entered an invalid option."
Can someone please clue me in on what is wrong with my syntax; what teh correct syntax is for using "and" "or" in similar statements.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to do multiple comparisons on a series of numbers from an array:
I send the numbers in file1 through want to print out some info from file2 based on some conditions.
The syntax just isn't correct???
awk '
NR==FNR{
a=$0
next
... (2 Replies)
Discussion started by: dcfargo
2 Replies
2. Shell Programming and Scripting
Is it possible to setup two conditions for an if then statement in a pbash script?
For example, depending on the text value of a variable I parse out of an xml file, I want to assign it a numerical values.
Example:
if ; then
VAR="25"
fi
if ; then
VAR="25"
fi
Can these two... (3 Replies)
Discussion started by: audiophile
3 Replies
3. Shell Programming and Scripting
Hi All,
I am new to shell scripting.
Can any one say what is wrong in this if statement, that uses multiple conditions
if
then
***************
else
if ( -z $pcs && "$night_time_calc" > "$night_time" )
then
********************************
... (4 Replies)
Discussion started by: ssenthilkumar
4 Replies
4. Shell Programming and Scripting
Please help me. I have been doing this for several hours.
Here is the code
if then
echo a b c d >> file.txt
echo 1111 >> file.txt
fi
The reason I want the two echo is because I want these statements printed on multiple lines. I keep getting error .
First it tells me... (2 Replies)
Discussion started by: asemota
2 Replies
5. Shell Programming and Scripting
Hi,
Hav automated a process, and it is working fine.
for first process alone
status = ` ps -ef |grep a `
if
then
echo " Success" > temp/logfile
else
echo " Failure" > temp/logfile
fi
Now I hav to write script to automated some 2 process and then send mail using cron..
... (5 Replies)
Discussion started by: NehaKrish
5 Replies
6. Shell Programming and Scripting
how can we execute multiple statements in
else condition
i have
if
then
statement
else
statements
fi
in else condition i have multiple statements
but it executing only one statement
is there any way to execute multiple statements (4 Replies)
Discussion started by: nani1984
4 Replies
7. Shell Programming and Scripting
Hi All,
I need to check for 3 conditions and if all the 3 are not satified need to say that services are not running....
is the below code correct.
#********** Check to see if Service 1 is still running**************
if
then
echo "$datetimestamp: Service1 is not running" >>... (4 Replies)
Discussion started by: ch33ry
4 Replies
8. Shell Programming and Scripting
I'm working on a script for class as a final project. We have to ask for values (city, state, zip) five times, but the state can only be MI, IN, IL, or OH. I'm trying to do this with a while loop inside of a while loop, but I have no idea how to do it properly.
Here's what I have so far:
... (3 Replies)
Discussion started by: nickzourdos
3 Replies
9. UNIX for Dummies Questions & Answers
exmaple:
file1 and file2 has 1 bit
if
then
exit
else
send out email
fi
if
then
exit
else
send out email
fi
it exits the 1st if. did not continue with my 2nd if. thanks in advanced.
Please use CODE tags are suggested on every page when you post an item in... (7 Replies)
Discussion started by: lawsongeek
7 Replies
10. Shell Programming and Scripting
Hello,
I am new to scripting and I am trying to write a simple script that creates users and adds their passwords from two files; one a user list file and another a password list file.
For example, I have two files already.
$ cat file1
andy
stephane
aby
paul
$ cat file2
123
234... (4 Replies)
Discussion started by: FemoTheDon
4 Replies
LEARN ABOUT HPUX
rndc.conf
rndc.conf(4) Kernel Interfaces Manual rndc.conf(4)
NAME
rndc.conf - rndc configuration file
DESCRIPTION
is the configuration file for the BIND 9 name server control utility. This file has a structure and syntax similar to the configuration
file,
The standard (default) configuration file is located at The standard (default) configuration file is located at
Syntax
The syntax of the file is much simpler than that of the configuration file. It includes three statements and optional comments. Statement
blocks are enclosed in braces and terminated with a semicolon. Clauses in the statements are also semicolon-terminated.
A servername or keyname must be quoted using double quotes if it matches a keyword, such as having a key named .
The options Statement
The statement specifies the default server and key definition for the configuration.
The clause specifies the default server on which runs, if the server is not specified with the option in the command. defserver is the
name or IP address of a name server that is specified in a statement.
The clause specifies the default key that will authenticate the server's commands and responses if a key is not specified with the option
in the command. defkey is the name of a key that is specified in a statement.
The server Statement
The statement specifies the servername of a name server, as a host name or an IP address.
The clause specifies a keyname that matches a keyname in a statement.
Multiple statements are permitted.
The key Statement
The statement specifies the name, keyname, and definition of a key.
The clause identifies the encryption algorithm, algoname. Currently only is supported.
The clause contains the random key, secretvalue, that will be used for authentication. It is base-64-encoded, using the algorithm speci-
fied in the clause. secretvalue is enclosed in double quotes.
The BIND 9 program can be used to generate the secretvalue.
Multiple statements are permitted.
Comments
The following comment styles are supported:
C:
C++:
UNIX:
Name Server Configuration
The name server must be configured to accept connections and to recognize the key specified in the file, using the statement in
WARNINGS
Currently, there is no way to specify the port on which must run.
EXAMPLES
Example 1
Here is a sample file:
In this example, will, by default, use the server at (127.0.0.1) and the key named Commands directed to the server will use the key. The
statement indicates that uses the HMAC-MD5 algorithm and its clause contains the base-64 encoding of the HMAC-MD5 secret enclosed in double
quotes.
Example 2
To generate a random secretvalue with the command (see rndc-confgen(1)):
A complete file, including the randomly generated key, is written to standard output. Commented-out and statements for are also written.
Example 3
To generate the secretvalue with the command (see dnssec-keygen(1)):
The base-64 secretvalue will appear in two files, and After you copy the secretvalue into statements in the and files, you can delete the
and files.
AUTHOR
was developed by the Internet Systems Consortium (ISC).
SEE ALSO
dnssec-keygen(1), rndc(1), rndc-confgen(1), named(1M).
available online at
available from the Internet Systems Consortium at
BIND 9.3 rndc.conf(4)