09-10-2008
Whats wrong with this IF condition?
I have four variables, dumpdata, defndata, compare1 and compare2
I want an IF statement condition which returns true when either dumpdata=defndata or (dumpdata<=compare1 and dumpdata>=compare2).
But this is not working for me..
if [ $dumpdata=$defndata || (( $dumpdata <= $compare1 ) && ( $dumpdata >= $compare2 )) ]
Last edited by indianjassi; 09-10-2008 at 01:55 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Whats wrong with below logic or syntax???? (4 Replies)
Discussion started by: dsravan
4 Replies
2. Shell Programming and Scripting
Hi all,
#!/bin/ksh
BIN=/interface/Gunner
age=$1
directory="$2"
&& directory=.
cd "$directory" || exit 1
from=`$BIN/today -$age`
cd $BIN
for i in `cat filestoarchive.txt`;do
cd $i
find . -mtime 14 | grep -v '.tar$' | $BIN/dttmfilter | awk '$1<="'$from'"{ print;};' | \
done (2 Replies)
Discussion started by: kayarsenal
2 Replies
3. Shell Programming and Scripting
#! /bin/bash
head -5 $1
echo "remove $1 ?"
read answer
if
then
echo invalid answer
elif
rm $1
echo "$1 is deleted"
elif
then
echo file is not deleted
else
echo "invalid answer"
fi
What i really want this to do is to ask to delete the file or not..it says something wrong... (1 Reply)
Discussion started by: nadman123
1 Replies
4. Shell Programming and Scripting
#! /bin/bash
USAGE=" | ]
if
then
echo "$USAGE"
exit 1
fi
while getopts lb: OPTION
do
case $(OPTION)in
a) echo Hi there!
exit 2;;
b) echo hello
o) OARG=$OPTARG;;
\?)echo "$USAGE" ;;
exit 2;;
esac
done
shift `expr... (1 Reply)
Discussion started by: nadman123
1 Replies
5. Shell Programming and Scripting
for i in `cat rgu`
do
echo $i
sed -e '/LABEL=$i/,/fi/d' g_scripts > g_scripts2
cat g_scripts2 > g_scripts
done (3 Replies)
Discussion started by: santosh1234
3 Replies
6. UNIX for Dummies Questions & Answers
can anyone tell me why this code doesn't work how its supposed to, its the hangman game but it doesn't play how its supposed to
#!/bin/bash
NoAttempts="0"
livesgiven="5"
LivesRemain=$livesgiven
LettersAttempted=""
wordfile=words
numwords=0
function menu()
{
clear
cat << menu... (1 Reply)
Discussion started by: ferrycorsten73
1 Replies
7. Homework & Coursework Questions
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:
ls -ld htdocs
drwxr-x--- 3 root root 8192 2006-11-19 10:41 htdocs
How would a host administrator... (1 Reply)
Discussion started by: Larry_1
1 Replies
8. UNIX for Dummies Questions & Answers
hi whats wrong in below??
CHECK=M10;
if ;
then
echo "hello hi";
else
echo "how are u hello hi";
fi
I am getting error as
./test.sh: line 2: '
./test.sh: line 2: M10: command not found
./test.sh: line 2: M10: command not found
./test.sh: line 2: M10: command not found (8 Replies)
Discussion started by: skyineyes
8 Replies
9. Shell Programming and Scripting
Hi there,
i have a problem i have created followning sh files some years ago but now it dosen`t work anymore i never used it a long time. Can anyone find the Error? Its always runs the stop() block and trying to Killing the Server also if i try to start or creat a new one.
#!/bin/sh
stop()... (6 Replies)
Discussion started by: NewCannon
6 Replies
10. UNIX for Beginners Questions & Answers
Hi
I am pretty new to bash scripting.I am trying to write the if statement in bash and it give me error. Can you please help me what I am doing wrong in If statement?
if && &&
then
fector=$kk;
divide=$DB_SIZE/$kk;
echo "factor value:$fector"
echo"divide value:$divide"... (1 Reply)
Discussion started by: Gevni
1 Replies
LEARN ABOUT NETBSD
kvm_dump_inval
KVM_DUMP(3) BSD Library Functions Manual KVM_DUMP(3)
NAME
kvm_dump_mkheader, kvm_dump_wrtheader, kvm_dump_inval -- crash dump support functions
LIBRARY
Kernel Data Access Library (libkvm, -lkvm)
SYNOPSIS
#include <kvm.h>
int
kvm_dump_mkheader(kvm_t *kd, off_t dump_off);
int
kvm_dump_wrtheader(kvm_t *kd, FILE *fp, int dumpsize);
int
kvm_dump_inval(kvm_t *kd);
DESCRIPTION
First note that the functions described here were designed to be used by savecore(8).
The function kvm_dump_mkheader() checks if the physical memory file associated with kd contains a valid crash dump header as generated by a
dumping kernel. When a valid header is found, kvm_dump_mkheader() initializes the internal kvm data structures as if a crash dump generated
by the savecore(8) program was opened. This has the intentional side effect of enabling the address translation machinery.
A call to kvm_dump_mkheader() will most likely be followed by a call to kvm_dump_wrtheader(). This function takes care of generating the
generic header, the CORE_CPU section and the section header of the CORE_DATA section. The data is written to the file pointed at by fp. The
dumpsize argument is only used to properly the set the segment size of the CORE_DATA section. Note that this function assumes that fp is
positioned at file location 0. This function will not seek and therefore allows fp to be a file pointer obtained by zopen().
The kvm_dump_inval() function clears the magic number in the physical memory file associated with kd. The address translations must be
enabled for this to work (thus assuming that kvm_dump_mkheader() was called earlier in the sequence).
RETURN VALUES
All functions except kvm_dump_mkheader() return 0 on success, -1 on failure. The function kvm_dump_mkheader() returns the size of the head-
ers present before the actual dumpdata starts. If no valid headers were found but no fatal errors occurred, 0 is returned. On fatal errors
the return value is -1.
In the case of failure, kvm_geterr(3) can be used to retrieve the cause of the error.
SEE ALSO
kvm(3), kvm_open(3)
HISTORY
These functions first appeared in NetBSD 1.2.
BSD
March 17, 1996 BSD