03-04-2008
Problem with global and local variables
Guys, how can I define global variables in sorlaris...cause I lose the values outside the scope.
Rite now wat I do is,I redirect variable value to a file n then get it back outside the function...
....theres obviously a better way of doing this...I now this is a basic question....but please help.....
Last edited by qzv2jm; 03-04-2008 at 04:10 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have encountered a very weird behavior of a global variable in Korn Shell in AIX:
A function f1 in my script pipes the output of the function f2 to a program.
A variable defined as global using typeset gets its value in f2.
That value is not seen in f1. If I remove the pipe ksh recognizes the... (2 Replies)
Discussion started by: odashe318
2 Replies
2. Programming
Please go through the following two versions of code :-
Version 1 --- string1 and string2 declared as Global variables
The output is :-- (as expected sprintf is overwriting the first byte of string2 with NULL)
string1=send
string2=
#include <stdio.h>
char string1;
char string2;
main()... (2 Replies)
Discussion started by: kms
2 Replies
3. Shell Programming and Scripting
Can someone give me "the lecture" on why you shouldn't make all your varables global when programming in perl. I have been doing this but I have heard that it is not a good practice. (3 Replies)
Discussion started by: reggiej
3 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I hav created a script that calls a sub-script. In both the scripts i called the configuration file. Now i wanted to use a variable that should be used in both script and sub-script files. Actually, i wanted to return a file name and the return status to the script file from the sub-script.... (6 Replies)
Discussion started by: Swapna173
6 Replies
5. Solaris
is this the step?
add fs
set dir=/export
set special=/export
set type=lofs
add options rw
end
i notice i can't post immediately, moderator needs to moderate. i have 1 more post still haven't appear in the forum..hmm.... (1 Reply)
Discussion started by: binary0011
1 Replies
6. Solaris
Hi Guys,
My requirement is I have file called /opt/orahome/.profile in non global zone.
PATH=/usr/bin:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/usr/openwin/bin:.
export PATH
PS1="\${ORACLE_SID}:`hostname`:\$PWD$ "
export PS1
EDITOR=vi
export EDITOR
ENV=/opt/orahome/.kshrc
export ENV... (1 Reply)
Discussion started by: vijaysachin
1 Replies
7. HP-UX
I am seeing different output from "who -u" when we execute "who -u" in global INIT and local SRP after calling telnet, rlogin and remsh. We are not seeing correct output when we login to local SRP using telnet, rlogin and remsh.
srp_init just creates an UTMP entry in the UTMP database. Based my... (1 Reply)
Discussion started by: madhur.tripathi
1 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I have a script which can be called from any path on the machine. It kind of acts like a global script. How do I achive this? :confused:
The path from which I call it is different from the path where it exists.
(where <script name> )
Thanks and Regards,
Preetham R. (1 Reply)
Discussion started by: preethgideon
1 Replies
9. Shell Programming and Scripting
hi,
i have a shell script which calls another shell which in turn calls another shell script.
Main_shell_script.sh
echo "In Main_shell_script.sh"
FILENAME="original.txt" # LINE 1
DST_FILENAME=$FILENAME # LINE 2
echo "FILENAME = {$FILENAME}"
echo "DST_FILENAME =... (3 Replies)
Discussion started by: Little
3 Replies
10. UNIX for Dummies Questions & Answers
hi all,
i need a help for the following query.
Thanks in advance for your valuable time.
i have a main.pl file which has a global variable declared as below.
our myVar=0;
call first.pl script from the main.pl script.
print the value of myVar (the value is still 0 and not 10.)
i have a... (1 Reply)
Discussion started by: hemalathak10
1 Replies
LEARN ABOUT PHP
import_request_variables
IMPORT_REQUEST_VARIABLES(3) 1 IMPORT_REQUEST_VARIABLES(3)
import_request_variables - Import GET/POST/Cookie variables into the global scope
SYNOPSIS
bool import_request_variables (string $types, [string $prefix])
DESCRIPTION
Imports GET/POST/Cookie variables into the global scope. It is useful if you disabled register_globals, but would like to see some vari-
ables in the global scope.
If you're interested in importing other variables into the global scope, such as $_SERVER, consider using extract(3).
Warning
This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
PARAMETERS
o $types
- Using the $types parameter, you can specify which request variables to import. You can use 'G', 'P' and 'C' characters respec-
tively for GET, POST and Cookie. These characters are not case sensitive, so you can also use any combination of 'g', 'p' and 'c'.
POST includes the POST uploaded file information.
Note
Note that the order of the letters matters, as when using " GP", the POST variables will overwrite GET variables with the
same name. Any other letters than GPC are discarded.
o $prefix
- Variable name prefix, prepended before all variable's name imported into the global scope. So if you have a GET value named "
userid", and provide a prefix " pref_", then you'll get a global variable named $pref_userid.
Note
Although the $prefix parameter is optional, you will get an E_NOTICE level error if you specify no prefix, or specify an
empty string as a prefix. This is a possible security hazard. Notice level errors are not displayed using the default error
reporting level.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
import_request_variables(3) example
<?php
// This will import GET and POST vars
// with an "rvar_" prefix
import_request_variables("gp", "rvar_");
echo $rvar_foo;
?>
SEE ALSO
$_REQUEST, register_globals, Predefined Variables, extract(3).
PHP Documentation Group IMPORT_REQUEST_VARIABLES(3)