08-02-2011
i wanted know if multiple if's can be handeled in anyother way or what i have written is correct
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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 ] ;then
$x=$vr1
else
print "You have entered an invalid option."
Can someone please clue me in on what is wrong with my syntax;... (3 Replies)
Discussion started by: tim mauger
3 Replies
2. 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
3. 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
4. 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
5. 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
6. Shell Programming and Scripting
Hi ,
I have a peculiar problem.
i have an if block like this
if ;
then
echo " todays date is " ${date} >> log_file
echo " file count is " $ count >> log_file
mv filename1 filename 2
else
echo "no files available ">> log_file
fi
the echo statement "no files available " is not... (2 Replies)
Discussion started by: wizardofoz
2 Replies
7. Shell Programming and Scripting
Hi everyone,
May you help me with the correct syntax of the follow bash statements please
X=10
if ]; then
echo "The value is between 1 and 5"
for ((i=1;i<=${X})); do
echo $i
done
else if ]; then
echo "The value is between 6 and 10"
for ((i=1;i<=${X})); do
... (5 Replies)
Discussion started by: Ophiuchus
5 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 OSX
vop_readdir
VOP_READDIR(9) BSD Kernel Developer's Manual VOP_READDIR(9)
NAME
VOP_READDIR -- read contents of a directory
SYNOPSIS
#include <sys/param.h>
#include <sys/dirent.h>
#include <sys/vnode.h>
int
VOP_READDIR(struct vnode *vp, struct uio *uio, struct ucred *cred, int *eofflag, int *ncookies, u_long **cookies);
DESCRIPTION
Read directory entries.
vp The vnode of the directory.
uio Where to read the directory contents.
cred The caller's credentials.
eofflag Return end of file status (NULL if not wanted).
ncookies Number of directory cookies generated for NFS (NULL if not wanted).
cookies Directory seek cookies generated for NFS (NULL if not wanted).
The directory contents are read into struct dirent structures. If the on-disc data structures differ from this then they should be trans-
lated.
LOCKS
The directory should be locked on entry and will still be locked on exit.
RETURN VALUES
Zero is returned on success, otherwise an error code is returned.
If this is called from the NFS server, the extra arguments eofflag, ncookies and cookies are given. The value of *eofflag should be set to
TRUE if the end of the directory is reached while reading. The directory seek cookies are returned to the NFS client and may be used later
to restart a directory read part way through the directory. There should be one cookie returned per directory entry. The value of the
cookie should be the offset within the directory where the on-disc version of the appropriate directory entry starts. Memory for the cookies
should be allocated using:
...;
*ncookies = number of entries read;
*cookies = (u_int*)#
malloc(*ncookies * sizeof(u_int), M_TEMP, M_WAITOK);
ERRORS
[EINVAL] An attempt was made to read from an illegal offset in the directory.
[EIO] A read error occurred while reading the directory.
SEE ALSO
vnode(9)
AUTHORS
This manual page was written by Doug Rabson.
BSD
July 24, 1996 BSD