I've been wondering if I can make mutexes much easier to use in C++ with creative use of a locking class and variable scope, but I'm not sure if things happen in the order I want. Here's pseudocode for something that could use the class:
int someclass::getvalue()
{
int retval;
... (0 Replies)
Hi,
I am stuck while developing a shell sub-routine which checks the log file for "success" or "failure". The subroutine reads the log file and checks for key word "success", if found it set the variable (found=1). It returns success or failure based on this variable.
My problem is, I can... (2 Replies)
Hi All,
I am new to unix shell scripting,
in the below script "num" is an input file which contains a series of numbers example :
2
3
5
8
I want to add the above all numbers and want the result finally outside the while loop. it prints the value zero instead of the actual expected... (13 Replies)
hi all,
i'm using the following script,
Status=1
Function_do ()
{
while read line;
do
if ; then
#echo $line
if ; then
Status=0
echo " LINKINK ERROR "
fi
fi
done < ldd.log
}
Function_do (4 Replies)
cat test.ksh
#!/usr/bin/ksh
VAR="Dear Friends \n How are you? \n Have a nice day \n"
export VAR
echo "Inside test.ksh";
./test.pl
cat test.pl
#!/usr/bin/perl
print "Inside test.pl \n";
print "$VAR";
Output:
./test.ksh
Inside test.ksh
Inside test.plWhat I want to achieve is, I... (1 Reply)
Hi All,
I've been researching this problem and I am pretty sure that the issue is related to the while loop and the piping. There are plenty of other threads about this issue that recommend removing the pipe and using redirection. However, I haven't been able to get it working using the ssh and... (1 Reply)
Hi,
I use Korn Shell. Searched Forum and modified the way the file is input to the while loop, but still the variable does not seem to be retaining the final count.
while read name
do
Tmp=`echo $name | awk '{print $9 }'`
Count=`cat $Tmp | wc -l`... (6 Replies)
Hello! Before you "bash" me with
- Not another post of this kind
Please read on and you will understand my problem...
I am using the below to extract a sum of the diskIO on a Solaris server.
#!/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin; export PATH
TEMP1="/tmp/raw-sar-output.txt$$"... (3 Replies)
Hi All
Is there is any way to maintain the scope of the variable in unix
Example
x=1
j=1
while
do
..
....
....
while
do
..
..
x=x+1
done
#inner most while loop ends here
done
#outer loop ends here (8 Replies)
I have to admit that i have not used Perl at all and this is a singular occasion where i have to patch an existing Perl script. I dearly hope i do not have to do it again for the next 15 years and therefore try to avoid having to learn the programming language in earnest.
The OS is AIX 7.1, the... (2 Replies)
Discussion started by: bakunin
2 Replies
LEARN ABOUT SUSE
scope
scope(n) [incr Tcl] scope(n)
__________________________________________________________________________________________________________________________________________________NAME
scope - capture the namespace context for a variable
SYNOPSIS
itcl::scope name
_________________________________________________________________DESCRIPTION
Creates a scoped value for the specified name, which must be a variable name. If the name is an instance variable, then the scope command
returns a string of the following form:
@itcl object varName
This is recognized in any context as an instance variable belonging to object. So with itcl3.0 and beyond, it is possible to use instance
variables in conjunction with widgets. For example, if you have an object with a private variable x, and you can use x in conjunction with
the -textvariable option of an entry widget. Before itcl3.0, only common variables could be used in this manner.
If the name is not an instance variable, then it must be a common variable or a global variable. In that case, the scope command returns
the fully qualified name of the variable, e.g., ::foo::bar::x.
If the name is not recognized as a variable, the scope command returns an error.
Ordinary variable names refer to variables in the global namespace. A scoped value captures a variable name together with its namespace
context in a way that allows it to be referenced properly later. It is needed, for example, to wrap up variable names when a Tk widget is
used within a namespace:
namespace foo {
private variable mode 1
radiobutton .rb1 -text "Mode #1" -variable [scope mode] -value 1
pack .rb1
radiobutton .rb2 -text "Mode #2" -variable [scope mode] -value 2
pack .rb2
}
Radiobuttons .rb1 and .rb2 interact via the variable "mode" contained in the namespace "foo". The scope command guarantees this by return-
ing the fully qualified variable name ::foo::mode.
You should never use the @itcl syntax directly. For example, it is a bad idea to write code like this:
set {@itcl ::fred x} 3
puts "value = ${@itcl ::fred x}"
Instead, you should always use the scope command to generate the variable name dynamically. Then, you can pass that name to a widget or to
any other bit of code in your program.
KEYWORDS
code, namespace, variable
itcl scope(n)