General :: Bareword Found Where Operator Expected?
Oct 14, 2010
$dec93 = 93;
$ser = SERVO;
$lbit = uc(sprintf("%02x
", $dec93));
if($lbit == 5D){
print DATA "Byte11: $fbits11=$bstr11 Bits:[95-88] $ser
";
}else{
sleep(1);
}
Why do I get this error? Bareword found where operator expected at C:Perl ScriptsLbits.pl line 64, near "5D" (Missing operator before D?)
View 2 Replies
ADVERTISEMENT
Nov 23, 2010
I would like to compare the nmlookup result of IP's stored in the file ips with a list of PC names stored in the file pcs.
Code:
for line in `cat "ips"`
do
[code]....
View 2 Replies
View Related
Nov 8, 2010
if [ $games -gt 0 ] ; then
echo ""
echo "*** New Game! ***"
[code]....
View 6 Replies
View Related
Apr 16, 2011
I'm having a bit of an issue using overloaded operators in an already overloaded operator. In my following code, I have overloaded the && operator to compare two Course objects. The operator in turn goes to a function which calls other overloaded operators to compare private object variables of that object to compare them.
View 8 Replies
View Related
Jan 29, 2010
i am not able to understand the appropriate thing to put in the google search...
Is there a way to use the ?: operator for if-else decision in a shell script?
edit: the 'question mark - colon' operator (just editing so that its searchable by someone in need :-P)
View 3 Replies
View Related
Mar 14, 2010
I am using "if" to force a word under the condition that the first letter of that word must be a letter of the alphabet, regardless of capitalization, using the " "" != "" " syntax.
Like so:
Code:
if [[ "$interface" != "WHAT DO I PUT HERE?" ]] ; then
echo "Invalid input"
exit 1
fi
View 5 Replies
View Related
Apr 4, 2011
I have this simple awk program but it not prints var_cab whe^E or ^S or ^M after he finds the second ^C
/^C/ { var_cab = substr($0,1,28); ent = 0 ; print "estoy en cabecera" var_cab;}
/^E/ { if ( ent ==0 ) var_fech = substr($0,4,8) ; ent ++;
print var_cab var_fech $0; }
/^S/ { print var_cab var_fech $0; }
/^M/ { print var_cab var_fech $0; }
END { print var_cab,ent}
the input file is many lines like this, every new block stats with ^CAB
CABES3000088888880000007EAMB
ENT20090706D060709-888 0028560000000012VALLE CA'ZULIA5501, 5502, 5498 y 5535
SAL201008250000134900000321V1202935-MU
[code]....
View 4 Replies
View Related
May 13, 2011
On Slackware64 13.1 the as-installed en_GB locale gave Sunday as the first day of the week. This was not an issue until Xfce's Orage calendar was used when its display of Sunday as the first day of the week was offputting for someone used to Monday. A minor inconvenience but expected to be easy to fix.
At the command line:
Code:
c@CW8:~$ export LANG=en_GB <== same for en_GB.utf8
[code]....
View 2 Replies
View Related
Feb 18, 2010
I am trying to use the Linux Ramdisk y machine and followed the instructions oninux/Ramdisk/ramdisk.html to create a 4GB ramdisk (total memory is 8GB, linux 2.6.9)The issue is that it is taking me almost exactly the same time to read a 1GB file from ramdisk as it is from disk. I was expecting it to be atleast twice as fast.Has anyone encountered this before?
View 1 Replies
View Related
Jun 25, 2011
Y want to rename a bunch of files and directories to remove the space on the names, easy enough right?
Code:
for source in $(find ./); do target=$(echo "$source"|sed -e 's/ /_/g'); mv -f "$source" $target; done
Well, I thought that should have work but the problem is that $source comes up broken, when I run it with echo instead of mv I get the echo with broken names.
Code:
In this case "$source"="This is the file I want to rename"
$ echo "$source"
[Code]....
View 3 Replies
View Related
Feb 2, 2010
I worte some code, but I got error for complier.
Code is :
#include <stdio.h>
#include <stdlib.h>
[code]...
View 4 Replies
View Related
Dec 10, 2010
I am trying to install NS-2.1b9a in Fedora 8.0. I have already installed gcc-3.3 and made new link to the newly installed gcc. I used patch made for NS-2.1b9a (found in [URL]...-8-ubuntu.html) to install in Fedora 8.0. Now, when I run ./install I get follwoing error.
[Code]..
View 2 Replies
View Related
Feb 27, 2010
I have an Acer Aspire 6930g with an nVidia GeForce 9300m GS which has a broken screen. I have been using an external monitor for some time using Linux Mint, without issue.
I initially set this up with great difficulty using the small parts of the screen that would still display an image at the time. Now, however the screen is totally dead, I have since disconnected the laptop monitor in order to not cause issues.
The issue I am currently having is trying to use live distros.
I'll give you example: I boot ubuntu 9.10 32bit and it gets to the initial boot menu. I choose "Try Ubuntu..." It shows the loading screen. Screen goes blank when going to desktop
I tried Ctrl+Alt+F1 to get to a terminal, but the screen stays blank. The same thing happens with both Knoppix and Backtrack 4 as well. The display goes blank upon switching to the desktop.
View 2 Replies
View Related
Feb 12, 2011
i write this script:
[Code].....
i make this script to become a service ( i test it from bash, and my script work good), my problem is when i telnet to my local host (127.0.0.1) via a personal port like 5555 telnet give this error: ")syntax error: invalid arithmetic operator (error token is ", i know this error is for echo $(($A+$B)) and i know that telnet can not calculate $A+$B and the error is for this
View 3 Replies
View Related
Feb 24, 2010
if anyone knows plz explain this conditional operator timeout ? : MAX SCHEDULE_TIMEOUT
View 2 Replies
View Related
Apr 18, 2011
I'm having a bit of trouble getting the OR operator to work.This is the code that I have:
global.php:
Code:
$vars["admin link"] = "<a href='/path/to/admin.php'>Admin</a>";
$vars["admin ip"] = "xxx.xxx.xxx.xx1";
$vars["admin ip2"] = "xxx.xxx.xxx.xx2";
[Code]...
View 7 Replies
View Related
May 1, 2010
I have a binary value which I receive from a controller. Say this binary value is 42. Just plain hex 42. If you would look at that byte in a debugger you would see 42.Now this value hold 8 bits each indicating a high or a low output. So 0x42 = 01000010b. Which means bits 1 and 6 are '1'.When I would want to find out which bits are set and which are not in a language like C, I simply do:
Code:
mask = 0x80;
if (binval & mask) {...}
etc..
However I am programming in TCL, and I try to do:
Code:
set mask 0x80
if { [expr ($binval & $mask) > 0] } {...}
etc...
this fails. At the moment the expr is executed, $binval is evaluated and substituted so the expression I am evaluating is
Code:
set mask 0x80
if { [expr ('B' & '0x80') > 0] } {...}
etc...
Eventually I got it working by converting the $binval into a '0x42' string value, like this:
Code:
binary scan $binval c byte
set byte [format "0x%0x" $byte]
set mask 0x80
if { [expr ($byte & $mask) > 0] } {...}
etc...[
Then the expression yields what I want. But this seems so stupid and clumsy. Isn't there a better way where I can compare two binary values without conversions?
View 14 Replies
View Related
Jul 13, 2011
I have a simple program from book C++ cookbook, page 291, 8.3, Using Constructors and Destructors to manage resources (or RAII), but it can not get compiled in my g++
------------------------------------------------------------------------------------------------
// Example 8-3. Using constructors and destructors
#include <iostream>
#include <string>
using namespace std;
[code]....
View 2 Replies
View Related
Feb 8, 2010
I'm very new at Bash scripting and have a bone head issue that I'm trying (and failing) to resolve. I cannot get this one IF statement to work, it seems the comparison operator does not think the resulting number from the $b*$c+$b operation is an integer even though it is a number. Below is a small proof of concept script with the bit I'm having trouble with.
Code:
#! /bin/bash
a=800
b=700
c=.15
if [ "$a" -le "$(echo "($b*$c+$b)"|bc)" ]
[Code]...
View 6 Replies
View Related
Sep 1, 2014
Is there a way to achieve the following with the square bracket operator?I have a class:
Code: Select allclass A
{
public:
void SetValue(int index, Item* B);
private:
int m_iCount;
ItemCollection Item_Collection;
[code]....
The probelm is that I am not just blindly assigning whatever given on the right hand side to the returned value from operator [], I need to verify it's not NULL, and it is not already there in the Item_Collection, and I also need to increase the count.
View 5 Replies
View Related
May 10, 2011
I know it is wrong to use the "==" operator to compare the equality of two floating point numbers. Logically it would seem that if the "==" operator is not usable for floating point comparison, then the "<=" operator would also not be usable. Is this true? The lack of google search results on this topic made me think that it must be true. If that is true, then is it true that the only way to compare floats with <= or >= is with something like the code below? Code: bool smaller_than_or_equal(float a, float b) {
if ( fabs(a-b) < EPSILON){return true;}
else if (a < b) {return true;}
else {return false;}
} I think this is a general question, but if specifics are necessary, I am using the C++ language to code at the moment.
View 5 Replies
View Related
Nov 25, 2010
Does anybody here use Tyan System Operator (TSO) in ubuntu sever? It seems that the packages are for redhat only
View 3 Replies
View Related
Jan 4, 2010
I am trying to learn C++.I implemented a simple archive program, and I am in a situation in which the user is prompted by a menu to make a choice.So I have some cout instruction to illustrate the possible choices and then
int choice;
cin>>choice;
and everything works fine.I introduced this code in a "while" loop that checks wether the choice made by the user is valid or not:
bool check=true;
int choice;
while(check)
{
cin>>choice;
if(the choice is valid) {...;check=false}
else cout<<"please make an other choice"
}
What is happening is that if by mistake the user introduces a character in place of a number, the loop repeats indefinitely because the program, when it get to the "cin" instruction, does not pauses to wait for a new input.
View 7 Replies
View Related
Apr 25, 2010
Can one of you point me towards a comprehensive print function tutorial in perl? I was under the impression that everything within quotes will get interpolated - but I am running into exceptions where it is not desirable to run some varaibles under quotes.
ordinal.pl
1 #!/usr/bin/perl
2 $idx = 1;
3 foreach $letter (a..z) {
4 print "Letter #",$idx++," is: $letter
";
5 #print "Letter # $idx++ is: $letter
[Code]...
View 9 Replies
View Related
Jun 12, 2010
I've been reading and googling, etc. I've seen some things, but not a definite explanation of this. What is the appropriate way to mimic a C ternary operator using Python? Isn't there an exact proper way to do it? Any difference for using lambda functions? I'm sorry, but I've been searching and it's ambiguous to me how this should be handled. I would appreciate a person's help on this. I came up with this link, but I'm wondering if I'm missing something.[URL]...
So, is that it? In Dive Into Python, it's using the and-or trick. Well, if the above post is the full explanation,
View 6 Replies
View Related
Jun 27, 2010
how to overload the subscript operator ([]) for a list class?
Code:
template <typename T>
class list
{
public:
struct node
[Code]...
View 1 Replies
View Related
Oct 26, 2010
I have been spending several days getting wxwidgets to work in code::blocks ide on several different platforms. Now I am down to one instance that I can't figure out. I have wxwidgets working in Fedora 13 x64, but cannot get it to work in a Fedora 13 x32 version. Actually, wxwidgets seem to be installed OK, but I run into compiler errors when I try to compile the default wxhello project. I get quite a few messages, in different header files, of this type:
/usr/include/assert.h:39:42: error: missing binary operator before token "("#if defined __cplusplus && __GNUC_PREREQ (2,95) From my friend Google this would seem to be caused by an older version of boost (before 1.37) - see http://bugs.xmms2.xmms.se/view.php?id=2215 ("It is an issue with old versions of boost and gcc4.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36453 It is fixed in boost 1.37")
I did a yum info command on both systems for every relevant package I could think of, including gcc(v4.4.4), gcc-c++(4.4.4), libgcc(4.4.4), libstdc++(4.4.4), boost(1.41.0), wxGTK(2.8.11), wxBase(2.8.11). Both systems are fully updated and have the same versions, with the only difference being 32 vs 64 bit. The same headers compile with no errors on the x64 system, but not x32. I have been able to find no other reason for this error than older versions of the preprocessor, yet that is apparently not the case here).
View 1 Replies
View Related
Feb 7, 2011
I'm trying to make a bash script that takes away two decimal numbers. This is to work out partitioning information.
Code:
hddsize=`sudo parted -s /dev/sda unit GB print | grep "Disk" | tr -d [A-Z][a-z] | tr -d '/: '`
trimsize="1.5"
partitionendsize=$(($hddsize - $trimsize))
I get an invalid arithmetic operator. Not sure how to minus these two numbers. Is it a floating point issue?
View 1 Replies
View Related
Mar 27, 2010
I have tryed out this operator on program:
Code:
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
ofstream myfile;
[code]...
which definitly is not the same number. I guess somewhere in the convertion from double to char* ("<<") something is not right and what can i do to save these double numbers in an accurate manner in a file?
View 14 Replies
View Related
Feb 21, 2011
I have a program that takes a relative path as input appends it to a some path string to get the actual path.
Now all I can input is the relative path. So if I want to go one level above my input will be ../mypath.
If I know the depth of the path used internally, I can use .. as many times to go to the root directory and then give the absolute path. But suppose I do not know the depth of the directory, can I construct a relative path string such that it considers it as a relative path. One way could be to have enough .. in the path string so that I can force an absolute path for some maximum depth of path.
Is there some path string syntax that I am not aware of but can achieve this?
View 2 Replies
View Related