Hi All,
I have declared a variable in script1 and assign a value for it. In script2 i'll call script1 and then I want the value of variables set in script1.
I have tried with export, but in vain.
How can I achive this?
Below is the two scripts.
--script1
#!/usr/bin/ksh
echo $1... (1 Reply)
Heres an example.....
<~/abc>$ cat textfile
line 1
line 2
line 3
line 4
line 5
<~/abc>$ cat try.sh
#/bin/ksh
for runs in 1 2 3
do
A=$runs
echo "Inside A : $A"
done
echo "Outside A : $A" <- works fine (1 Reply)
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
Hi all,
I hav created one profile file in which i have declared some variables
i want to knw how can i access these variables into my xyz.ksh file when i am trying to do " echo $variablename " its giving me an empty line i have done export variable also in the profile file.
Thanks in... (6 Replies)
I call my script with two parameters
myscript.sh aaa bbb
What is the way to access $1 and $2 values inside a function? I call the function like this
myfuntion $1 $1
but inside of the function, $1 and $2 are empty. Any suggestions? thank you in advanced. (1 Reply)
Hi ,
I'm trying to change the variable value in a while loop , however its not working it seems that the problem with subshells while reading the file.
#!/bin/sh
FLAG=0;
cat filename | while read data
do
FLAG=1;
done
echo $FLAG
Should display 1 instead displays 0 (13 Replies)
If I set a variable within a while-read loop, sometimes it's local to the loop, sometimes it's global, depending on how the loop is set up. I'm testing this on a Debian Lenny system using both bash and dash with the same results.
For example:
# Pipe command into while-read loop
count=
ls -1... (2 Replies)
Friends,
I am using ksh under SunoS. This is what I have
In file1.sh
NOW=$(date +"%b-%d-%y")
LOGFILE="./log-$NOW.log"
I will be using this file through file1.sh as log file.
I have another script file2.sh which is being called inside my file1.sh. I would like to use the same log... (6 Replies)
Hello forum,
I am siva working as programmer .I was blocked with the below issue so please help any of the forum memebers.
testve.h
class cv
{
protected :
struct state;
state& m_state;
};
testVe.cpp
struct state
{
m_size;
}
the above are 2 files which have the... (3 Replies)
Discussion started by: workforsiva
3 Replies
LEARN ABOUT DEBIAN
je::scope
JE::Scope(3pm) User Contributed Perl Documentation JE::Scope(3pm)NAME
JE::Scope - JavaScript scope chain (what makes closures work)
DESCRIPTION
JavaScript code runs within an execution context which has a scope chain associated with it. This class implements this scope chain. When a
variable is accessed the objects in the scope chain are searched till the variable is found.
A JE::Scope object can also be used as global (JE) object. Any methods it does not understand will be delegated to the object at the bottom
of the stack (the far end of the chain), so that "$scope->null" means the same thing as "$scope->[0]->null".
Objects of this class consist of a reference to an array, the elements of which are the objects in the chain (the first element being the
global object). (Think of it as a stack.)
METHODS
find_var($name, $value)
find_var($name)
This method searches through the scope chain, starting at the end of the array, until it finds the variable named by the first
argument. If the second argument is present, it sets the variable. It then returns an lvalue (a JE::LValue object) that references the
variable.
new_var($name, $value)
new_var($name)
This method creates (and optionally sets the value of) a new variable in the variable object (the same thing that JavaScript's "var"
keyword does) and returns an lvalue.
The variable object is the first object in the scope chain (searching from the top of the stack) that is a call object, or
"$scope->[0]" if no call object is found.
CONSTRUCTOR
None. Just bless an array reference. You should not need to do this because it is done for you by the "JE" and "JE::Object::Function"
classes.
SEE ALSO
JE
JE::LValue
JE::Object::Function
perl v5.14.2 2012-03-18 JE::Scope(3pm)