I generally avoid eval, but have you considered making your shell script more like your C++ code?
The while loops in the above script could be simplified to for loops that are accepted by many shells (including recent versions of bash and ksh) but they are extensions to the standards and, therefore, not available in several shells. The above code just uses standard utility interfaces and shell language constructs. For shells that accept these extensions, the below code looks even more like your C++ code.
Note that both of these script write their error messages to the standard error output instead of to standard output and both of these script print the argument numbers of the first found pair of identical argument in their diagnostics.
When discussing inodes and data blocks, I know Solaris creates these data blocks with a total size of 8192b, divided into eight 1024b "fragments." It stores data in "contiguous" fragments and solaris doesn't allow a file to use portions of two different fragments. If the file size permits, then the... (4 Replies)
Discussion started by: manderson19
4 Replies
2. Post Here to Contact Site Administrators and Moderators
Hi guys!
I was wondering what the outcome was of your survey of a few months ago? One of the questions was if people were willing to pay for additional services like an own account, like username@unix.com with mail box, etc.
Sorry if I missed the results if you had already posted them.
Ivo (1 Reply)
For some reason ipfilter is blocking inbound fragmented ip packets (the packets are larger than the interface's MTU) that are encapsulating UDP segments. The connection works, so I know ipfilter is letting some traffic through, it is just a lot slower than it should be.
Rules that allow the... (3 Replies)
Upon replacing my linux router/server with a Solaris one I've noticed very poor network performance. The server itself has no issues connecting to the net, but clients using the server as a router are getting a lot of IP fragments as indicated from some packet sniffing I conducted.
Here was my... (3 Replies)
Hello ,
When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
I have a .xml file that looks something like this :
<measInfo>
.........
string1
.........
</measInfo>
<measInfo>
......
string2
........
</measInfo>
I want to extract only the 'chunk of file' from '<measInfo>' to '</measInfo>' containing string1 (or a certain string that I... (13 Replies)
Good morning all,
This is the file name in question OD_Orders_2019-02-19.csv
I am trying to create a bash script to read into files with yesterdays date on the file name while retaining the rest of the files name. I would like for $y to equal, the name of the file with a formula output with... (2 Replies)
Discussion started by: Ibrahim A
2 Replies
LEARN ABOUT DEBIAN
vend::counterfile
Vend::CounterFile(3pm) User Contributed Perl Documentation Vend::CounterFile(3pm)NAME
Vend::CounterFile - Persistent counter class
SYNOPSIS
use Vend::CounterFile;
$c = new Vend::CounterFile "COUNTER", "aa00";
$id = $c->inc;
open(F, ">F$id");
DESCRIPTION
(This module is modified from Gisle Aas File::CounterFile to use
Interchange's locking protocols -- lack of fcntl locking was causing
counter problems.)
This module implements a persistent counter class. Each counter is represented by a separate file in the file system. File locking is
applied, so multiple processes might try to access the same counters at the same time without risk of counter destruction.
You give the file name as the first parameter to the object constructor ("new"). The file is created if it does not exist.
If the file name does not start with "/" or ".", then it is interpreted as a file relative to $Vend::CounterFile::DEFAULT_DIR. The default
value for this variable is initialized from the environment variable "TMPDIR", or /usr/tmp is no environment variable is defined. You may
want to assign a different value to this variable before creating counters.
If you pass a second parameter to the constructor, that sets the initial value for a new counter. This parameter only takes effect when
the file is created (i.e. it does not exist before the call).
When you call the "inc()" method, you increment the counter value by one. When you call "dec()" the counter value is decrementd. In both
cases the new value is returned. The "dec()" method only works for numerical counters (digits only).
You can peek at the value of the counter (without incrementing it) by using the "value()" method.
The counter can be locked and unlocked with the "lock()" and "unlock()" methods. Incrementing and value retrieval is faster when the
counter is locked, because we do not have to update the counter file all the time. You can query whether the counter is locked with the
"locked()" method.
There is also an operator overloading interface to the Vend::CounterFile object. This means that you might use the "++" operator for
incrementing the counter, "--" operator for decrementing and you can interpolate counters diretly into strings.
BUGS
(This problem alleviated by this modified module)
It uses flock(2) to lock the counter file. This does not work on all systems. Perhaps we should use the File::Lock module?
COPYRIGHT
Copyright (c) 1995-1998 Gisle Aas. All rights reserved. Modifications made by and copyright (C) 2002 Red Hat, Inc. and (c) 2002-2007
Interchange Development Group
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Gisle Aas <aas@sn.no>
perl v5.14.2 2010-03-25 Vend::CounterFile(3pm)