05-15-2009
ignore negative number in script
Hi, does anyone know how to ignore whether a number is negative in a script. E.g. if I have a variable that contains -1200, how do I ignore the minus sign?
7 More Discussions You Might Find Interesting
1. Programming
hi people,
I have a function which I am passing a stream which is basically postfix notation
if(isdigit(in.peek()))
{
in >> number;
nums.push(number);
}
else if (strchr("+-*/", in.peek( )) != NULL)
{
in >> symbol;
do_operation(symbol, nums, okay);
}
... (1 Reply)
Discussion started by: Darklight
1 Replies
2. Shell Programming and Scripting
Hi,
I want to search for a return code of -3. Using grep "-3" *.* is giving a syntax error. Please suggest as to how can we search for this pattern using grep.
Thanks,
Krishna (2 Replies)
Discussion started by: kzmatam
2 Replies
3. HP-UX
Hi All,
Just faced an interesting thing in HP-UX. I was dividing 2955334616 / 2 by using echo `expr 2955334616 / 2` , and this ofcourse which expects 1477667308 to be returned. But I am getting -669816340 and I am :wall: how exactly this is possible. It is not one of the compliments (Ones or... (4 Replies)
Discussion started by: mail2sanand
4 Replies
4. Shell Programming and Scripting
Hello, I am trying to write a bash script which will give me the most negative number. Here is an example input:
Ce 3.7729752124 -4.9505731588 -4.1061257680
Ce -6.9156611391 -0.5991784762 7.3051893138
Ce 7.6489739875 0.3513020731 ... (6 Replies)
Discussion started by: sdl27789
6 Replies
5. Shell Programming and Scripting
I am using a small script to divide some numbers in a given file and display the output in another file. I am getting the following error
basename: invalid option -- '5'
Try `basename --help' for more information.
(standard_in) 1: syntax error
The script is :
#!/bin/bash
for i in `cat... (4 Replies)
Discussion started by: kmnr877
4 Replies
6. Shell Programming and Scripting
Hi All,
I am trying to compare two negative numbers using awk on linux.But it is giving me wrong result.Same code is working perfectly on solaris.
print ((0+new_price) < MIN_PRICE)
e.g If I try to compare -1.32(new_price) and -500(min_price) using "<" operator, output is 1 i.e true.
... (5 Replies)
Discussion started by: Rashmee
5 Replies
7. UNIX for Beginners Questions & Answers
Hi ALL,
I am having semi column separated file as below. I am having negative values for the records starting with 11095. How can I convert that positive number
I tried this below seems not working
sed 's/ \(*\)$/ -\1/;t;s/\(.*\)-/\1/ myfile
myfile... (6 Replies)
Discussion started by: arunkumar_mca
6 Replies
LEARN ABOUT CENTOS
xkbignoreextension
XkbIgnoreExtension(3) XKB FUNCTIONS XkbIgnoreExtension(3)
NAME
XkbIgnoreExtension - Prevents core X library keyboard functions from using the X Keyboard Extension
SYNOPSIS
Bool XkbIgnoreExtension (Bool *ignore);
ARGUMENTS
ignore True means ignore the extension
DESCRIPTION
If a server supports the Xkb extension, the X library normally implements preXkb keyboard functions using the Xkb keyboard description and
state. The server Xkb keyboard state may differ from the preXkb keyboard state. This difference does not affect most clients, but there are
exceptions. To allow these clients to work properly, you may instruct the extension not to use Xkb functionality.
Call XkbIgnoreExtension to prevent core X library keyboard functions from using the X Keyboard Extension. You must call XkbIgnoreExtension
before you open a server connection; Xkb does not provide a way to enable or disable use of the extension once a connection is established.
XkbIgnoreExtension tells the X library whether to use the X Keyboard Extension on any subsequently opened X display connections. If ignore
is True, the library does not initialize the Xkb extension when it opens a new display. This forces the X server to use compatibility mode
and communicate with the client using only core protocol requests and events. If ignore is False, the library treats subsequent calls to
XOpenDisplay normally and uses Xkb extension requests, events, and state. Do not explicitly use Xkb on a connection for which it is dis-
abled. XkbIgnoreExtension returns False if it was unable to apply the ignore request.
RETURN VALUES
True The XkbIgnoreExtension returns True if
False The XkbIgnoreExtension function returns False if it was unable to apply the ignore request.
SEE ALSO
XOpenDisplay(3)
X Version 11 libX11 1.6.0 XkbIgnoreExtension(3)