05-22-2008
Variables scope.
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
10 More Discussions You Might Find Interesting
1. Programming
I'm having a problem getting this to work..
I got 3 files,
start.C - Where i got my main() function
Menu.C & Menu.h - Where I'm trying to use hash_map
start.C
#include <iostream>
#include "Menu.h"
using namespace std;
int main() { /* test code here */ return 0; }
Menu.h ... (1 Reply)
Discussion started by: J.P
1 Replies
2. Programming
Each thread has a copy of auto variables within a function, but variables
declared as static within a function are common to all threads. To circumvent
this can static variables be placed outside the function. If so, will the
scope of the variable be file only or will it be extern, and will each... (7 Replies)
Discussion started by: sundaresh
7 Replies
3. UNIX for Advanced & Expert Users
Sorry in the wrong forum. Moving this to right forum. (2 Replies)
Discussion started by: Amruta Pitkar
2 Replies
4. Shell Programming and Scripting
My awk script searches for specified patterns in a text file and stores these values into mem variables.
Once this is done I want to Insert these values into a table.
How can I avail of the variable values outside the scope of awk script....
One method that I have tried is to write the... (7 Replies)
Discussion started by: Amruta Pitkar
7 Replies
5. Shell Programming and Scripting
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)
Discussion started by: qzv2jm
1 Replies
6. AIX
What is the scope of AIX as I am starting my career as a fresher in AIX administration?? (4 Replies)
Discussion started by: abhishek27
4 Replies
7. Shell Programming and Scripting
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)
Discussion started by: aristegui
1 Replies
8. Shell Programming and Scripting
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)
Discussion started by: mjd_tech
2 Replies
9. Shell Programming and Scripting
Hi,
I want to know about the variable scope in shell script.
How can we use the script argument inside the function?
fn () {
echo $1 ## I want this argument should be the main script argument and not the funtion argument.
}
also are there any local,global types in shell script?
if... (3 Replies)
Discussion started by: shellwell
3 Replies
10. Shell Programming and Scripting
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)
Discussion started by: dahlia84
6 Replies
LEARN ABOUT DEBIAN
swf::button
.::SWF::Button(3pm) User Contributed Perl Documentation .::SWF::Button(3pm)
NAME
SWF::Button - SWF button class
SYNOPSIS
use SWF::Button;
$button = new SWF::Button();
$button->setUp($shape1);
$button->setDown($shape2);
DESCRIPTION
Creates buttons for flash movies. Buttons are controlled by various methods for visible design and triggered actions, see below:
METHODS
new SWF::Button()
Creates a new Button object.
$button->addShape($shape, FLAG)
Adds $shape to the button. Using this method is not recommended, better use addCharacter(), see next item for details. Also unlike
addCharacter() this method does not return any SWF::ButtonRecord objects
$buttonrecord = $button->addCharacter($character [, $flags])
Adds character $shape to the button. Valid FLAGs are:
SWFBUTTON_HIT
SWFBUTTON_UP
SWFBUTTON_DOWN
SWFBUTTON_OVER
Unlike addShape() this method returns an object of SWF::ButtonRecord class. The flag states can be combined using the binary or
operator.
$buttonrecord = $button->setOver($shape)
Shortcut for $button->addCharacter($shape, SWFBUTTON_OVER);
$buttonrecord = $button->setHit($shape)
Shortcut for $button->addCharacter($shape, SWFBUTTON_HIT);
$buttonrecord = $button->setUp($shape)
Shortcut for $button->addCharacter($shape, SWFBUTTON_UP);
$buttonrecord = $button->setDown($shape)
Shortcut for $button->addCharacter($shape, SWFBUTTON_DOWN);
$button->addAction($action [,FLAG])
$button->setAction($action [,FLAG])
Adds $action object (see SWF::Action). Valid FLAGs are:
SWFBUTTON_MOUSEUP
SWFBUTTON_MOUSEOVER
SWFBUTTON_MOUSEOUT
SWFBUTTON_MOUSEDOWN
SWFBUTTON_DRAGOVER
SWFBUTTON_DRAGOUT
SWFBUTTON_MOUSEUP is the default value of FLAG.
$button->setMenu(0|1)
Parameter is 0 (off) or 1(on). Can be used for a slight different behavior of buttons.
$soundinstance = $button->addSound($sound, $flags)
Plays a prepared SWF::Sound object and returns an object of SWF::SoundInstance. Once more valid flags are:
SWFBUTTON_MOUSEUP
SWFBUTTON_MOUSEOVER
SWFBUTTON_MOUSEOUT
SWFBUTTON_MOUSEDOWN
For example:
$sound = new SWF::Sound("wow.mp3", SWF_SOUND_MP3_COMPRESSED );
$soundinstance = $button->addSound($sound, SWFBUTTON_MOUSEDOWN );
$button->setScalingGrid($x, $y, $w, $h)
This function (available from SWF>=8) sets a 9 slice scaling grid: 1 2 3 4 5 6 7 8 9 X, y, w and h define a rectangle, which is the
dimension of the center slice(5). All other slices are determined out of the characters bounds and the defined rect. While slice 5 is
scaled vertical and horizontal, slice 2 and 8 are only scaled horizontal. Slice 4 and 6 only vertical. The 4 corner slices are not
scaled (1, 3, 7, 9).
$button->removeScalingGrid()
Removes scaling grid rectangles.
AUTHOR
wrapper written by
Soheil Seyfaie (soheil at users dot sourceforge dot net) Peter Liscovius (peterdd at users dot sourceforge dot net) and many others.
SEE ALSO
SWF, SWF::Action, SWF::Shape, SWF::Movie, SWF::MovieClip, SWF::Constants, SWF::Sound, SWF::SoundInstance
perl v5.14.2 2011-10-26 .::SWF::Button(3pm)