Hello,
I kinda newbie in unix so I would like so help.I know that there is a command that compares two integer numbers test (eg. #$1=0 ).I would like to know if it is possible to compare any number with another (eg. 2.3=0 or 3.7!=0 4.5>2.2).
Thank you in advance. (1 Reply)
Can someone tell me how do I comapre two numbers with the decimals in UNIX shell scripting
I understand "-gt" can be used only for integers
Regards, Giri (4 Replies)
Hello, I'm searching for a quick method to read numeric values from a file or a defined variable and identifying the largest number. For instance if the following numbers are in a file or defined to a variable:
09192007 09202007 09182007 09172007 09162007
What "short" method could be used to... (7 Replies)
Hi There!
Apologies if this has been asked previously but I couldn't find the answer I was hoping for.
Basically, all I want to do is compare the OS X version against the version that I require in my script. So I'm retrieving the OS version using defaults read, but how can I compare this... (10 Replies)
Im trying to compare two numbers with decimals but its not working as expected.
a=1
b=1.1
if
then echo "equal"
fi
When I do this it says that the numbers are equal. Ultimately Im using -le and -ge in the if statements but I tested with -eq for simplicity.
Any way to make this... (3 Replies)
Hi. I do not know how to compare numbers and need help. In my script I have to figure the MAX, MIN, & Avg. Sales amounts.
Please help me.
In the code, "transaction" is a counter.
#!/bin/bash
clear
transaction=0
sales=0
total=0
while test $sales
... (9 Replies)
ValA=-29344
if ; then
echo "NEGATIVE"
else
echo "POSITIVE"
fi
Can someone please tell me how else they would go about doing the above?
When i do it, i get errors such as: (10 Replies)
For numbers between 0 and 1 the below logic is not working.
Output of above shall be "correct" but its echoing "incorrect".Kindly suggest
a=.1
if
then
echo correct
else echo incorrect
fi
Video tutorial on how to use code tags in The UNIX and Linux Forums. (3 Replies)
cat file1
a b c d e f
this is what is in my script
foreach i (`cat file1`)
foreach j (`cat file1`)
#do something here
end
end
basically i want to compare ab, ac, ad, ae, af, ba, bc, bd, be....
and also skipping aa,bb if possible..
if that anyway for me to just use 1 foreach? (2 Replies)
Discussion started by: ctphua
2 Replies
LEARN ABOUT MOJAVE
unset
unset(n) Tcl Built-In Commands unset(n)
__________________________________________________________________________________________________________________________________________________NAME
unset - Delete variables
SYNOPSIS
unset ?-nocomplain? ?--? ?name name name ...?
_________________________________________________________________DESCRIPTION
This command removes one or more variables. Each name is a variable name, specified in any of the ways acceptable to the set command. If
a name refers to an element of an array then that element is removed without affecting the rest of the array. If a name consists of an
array name with no parenthesized index, then the entire array is deleted. The unset command returns an empty string as result. If -nocom-
plain is specified as the first argument, any possible errors are suppressed. The option may not be abbreviated, in order to disambiguate
it from possible variable names. The option -- indicates the end of the options, and should be used if you wish to remove a variable with
the same name as any of the options. If an error occurs, any variables after the named one causing the error are not deleted. An error
can occur when the named variable does not exist, or the name refers to an array element but the variable is a scalar, or the name refers
to a variable in a non-existent namespace.
EXAMPLE
Create an array containing a mapping from some numbers to their squares and remove the array elements for non-prime numbers:
array set squares {
1 1 6 36
2 4 7 49
3 9 8 64
4 16 9 81
5 25 10 100
}
puts "The squares are:"
parray squares
unset squares(1)squares(4)squares(6)
unset squares(8)squares(9)squares(10)
puts "The prime squares are:"
parray squares
SEE ALSO
set(n), trace(n), upvar(n)
KEYWORDS
remove, variable
Tcl 8.4 unset(n)