Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

unset(1f) [opensolaris man page]

set(1F) 							   FMLI Commands							   set(1F)

NAME
set, unset - set and unset local or global environment variables SYNOPSIS
set [-l variable [=value]] ... set [-e variable [=value]] ... set [-ffile variable [=value]]... ... unset -l variable... unset -f file variable... DESCRIPTION
The set command sets variable in the environment, or adds variable=value to file. If variable is not equated it to a value, set expects the value to be on stdin. The unset command removes variable. Note that the FMLI predefined, read-only variables (such as ARG1), may not be set or unset. Note that at least one of the above options must be used for each variable being set or unset. If you set a variable with the -ffilename option, you must thereafter include filename in references to that variable. For example, ${(file)VARIABLE}. FMLI inherits the UNIX environment when invoked. OPTIONS
-l Sets or unsets the specified variable in the local environment. Variables set with -l will not be inherited by processes invoked from FMLI. -e Sets the specified variable in the UNIX environment. Variables set with -e will be inherited by any processes started from FMLI. Note that these variables cannot be unset. -ffile Sets or unsets the specified variable in the global environment. The argument file is the name, or pathname, of a file containing lines of the form variable=value. file will be created if it does not already exist. Note that no space intervenes between -f and file. EXAMPLES
Example 1 A sample output of set command. Storing a selection made in a menu: name=Selection 2 action=`set -l SELECTION=2`close NOTES
Variables set to be available to the UNIX environment (those set using the -e option) can only be set for the current fmli process and the processes it calls. When using the -f option, unless file is unique to the process, other users of FMLI on the same machine will be able to expand these vari- ables, depending on the read/write permissions on file. A variable set in one frame may be referenced or unset in any other frame. This includes local variables. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
env(1), sh(1), attributes(5) SunOS 5.11 5 Jul 1990 set(1F)

Check Out this Related Man Page

UNSET(3)								 1								  UNSET(3)

unset - Unset a given variable

SYNOPSIS
void unset (mixed $var, [mixed $...]) DESCRIPTION
unset(3) destroys the specified variables. The behavior of unset(3) inside of a function can vary depending on what type of variable you are attempting to destroy. If a globalized variable is unset(3) inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset(3) was called. <?php function destroy_foo() { global $foo; unset($foo); } $foo = 'bar'; destroy_foo(); echo $foo; ?> The above example will output: bar To unset(3) a global variable inside of a function, then use the $GLOBALS array to do so: <?php function foo() { unset($GLOBALS['bar']); } $bar = "something"; foo(); ?> If a variable that is PASSED BY REFERENCE is unset(3) inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset(3) was called. <?php function foo(&$bar) { unset($bar); $bar = "blah"; } $bar = 'something'; echo "$bar "; foo($bar); echo "$bar "; ?> The above example will output: something something If a static variable is unset(3) inside of a function, unset(3) destroys the variable only in the context of the rest of a function. Fol- lowing calls will restore the previous value of a variable. <?php function foo() { static $bar; $bar++; echo "Before unset: $bar, "; unset($bar); $bar = 23; echo "after unset: $bar "; } foo(); foo(); foo(); ?> The above example will output: Before unset: 1, after unset: 23 Before unset: 2, after unset: 23 Before unset: 3, after unset: 23 PARAMETERS
o $var - The variable to be unset. o $... - Another variable ... RETURN VALUES
No value is returned. EXAMPLES
Example #1 unset(3) example <?php // destroy a single variable unset($foo); // destroy a single element of an array unset($bar['quux']); // destroy more than one variable unset($foo1, $foo2, $foo3); ?> Example #2 Using (unset) casting (unset) casting is often confused with the unset(3) function. (unset) casting serves only as a NULL-type cast, for completeness. It does not alter the variable it's casting. <?php $name = 'Felipe'; var_dump((unset) $name); var_dump($name); ?> The above example will output: NULL string(6) "Felipe" NOTES
Note Because this is a language construct and not a function, it cannot be called using variable functions. Note It is possible to unset even object properties visible in current context. Note It is not possible to unset $this inside an object method since PHP 5. Note When using unset(3) on inaccessible object properties, the __unset() overloading method will be called, if declared. SEE ALSO
isset(3), empty(3), __unset(), array_splice(3). PHP Documentation Group UNSET(3)
Man Page