I cannot get the following substitution ($ORACLE_SID) to work:
The variable ORACLE_SID is set to wardin my environment. It has been exported.
I have a text file called test.dat:
/u07/oradata/${ORACLE_SID}/extab/finmart/summit/ps_voucher_line_crnt_ex.dbf... (2 Replies)
Hi,
I'm using a for loop reading from an input file that contains files, whose path includes a variable name.
But the for loop doesn't expand the variable and therefore can't find the file.
Here's an example:
File BACKUPFILES
/home/John/alpha
/home/Sue/beta... (8 Replies)
I'm trying to make a sed substitution where the substitution pattern is an environment variable to be expanded, but the variable contains a "slash".
sed -e 's/<HOME_DIRECTORY>/'$HOME'/'This gives me the following error:
sed: -e expression #1, char 21: unknown option to `s'Obviously this is... (2 Replies)
Hello,
so i'm making a script, using dynamic variables and trying to expand them. So far it hasn't worked out too well so it seems that I need some help from you, the elite.
Example:
#!/bin/sh
counter=0
until (($counter>5))
counter2=1
until (($counter2>6)); do
if ;... (5 Replies)
Hi,
In Cron file i'm using username and password hard-coded and now i wann to use environmental veraiables in cron file.
But Could you please guide me how to use these environmental variables in cron file ?
Thanks,
Shyamu.A (4 Replies)
Hello Everyone
I need to create a script file which must append some lines to a target text file, I'm using sed for windows, the script file look like this:
{
a\
STRINGTABLE DISCARDABLE\
BEGIN\
5, 150 {a\
#define RC_SHELL, "%ID_SHELL%"\
#define RC_NAME, "%ID_NAME%"\
END
}
... (1 Reply)
Hi,
I have around 10 environment variables in my shell script. i want to set this all in a file and just call that file in my shell script. How can i do that ? Please help. TIA! (6 Replies)
Hi All,
I need to understand following three environment variables and their usages in HP Unix.
_M_ARENA_OPTS
_M_CACHE_OPTS
PTHREAD_SCOPE_SYSTEM
How does these environment variables influence multi threaded applciation and how do we decide the value of these variables? Is there... (0 Replies)
Dear Forum members,
I am having trouble getting the complete filename (and directory path) in a variable.
Output directory mentioned in the code have three files:
DISPLAY_CITY_DETAILS_15-05-2019-08-29-26_MIGRATE_london.out
DISPLAY_CITY_DETAILS_15-05-2019-08-29-26_MIGRATE_paris.out... (4 Replies)
Hi All
Thanks for reviewing my question.
I have a sh script where I used an environmental variable for the directory for the file I need to check to ensure before executing a process.
I have confirmed the permissions and I can find the file if I use a hard coding of the directory. This is a... (5 Replies)
Discussion started by: rstojkovic68
5 Replies
LEARN ABOUT PHP
empty
EMPTY(3) 1 EMPTY(3)empty - Determine whether a variable is emptySYNOPSIS
bool empty (mixed $var)
DESCRIPTION
Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSE.
empty(3) does not generate a warning if the variable does not exist.
PARAMETERS
o $var
- Variable to be checked
Note
Prior to PHP 5.5, empty(3) only supports variables; anything else will result in a parse error. In other words, the follow-
ing will not work: empty(trim($name)). Instead, use trim($name) == false.
No warning is generated if the variable does not exist. That means empty(3) is essentially the concise equivalent to !isset($var)
|| $var == false.
RETURN VALUES
Returns FALSE if $var exists and has a non-empty, non-zero value. Otherwise returns TRUE.
The following things are considered to be empty:
o "" (an empty string)
o 0 (0 as an integer)
o 0.0 (0 as a float)
o "0" (0 as a string)
o NULL
o FALSE
o array() (an empty array)
o $var; (a variable declared, but without a value)
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.5.0 | |
| | |
| | empty(3) now supports expressions, rather than |
| | only variables. |
| | |
| 5.4.0 | |
| | |
| | Checking non-numeric offsets of strings returns |
| | TRUE. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
A simple empty(3) / isset(3) comparison.
<?php
$var = 0;
// Evaluates to true because $var is empty
if (empty($var)) {
echo '$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
echo '$var is set even though it is empty';
}
?>
Example #2
empty(3) on String Offsets
PHP 5.4 changes how empty(3) behaves when passed string offsets.
<?php
$expected_array_got_string = 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
Output of the above example in PHP 5.3:
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Output of the above example in PHP 5.4:
bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
NOTES
Note
Because this is a language construct and not a function, it cannot be called using variable functions.
Note
When using empty(3) on inaccessible object properties, the __isset() overloading method will be called, if declared.
SEE ALSO isset(3), __isset(), unset(3), array_key_exists(3), count(3), strlen(3), The type comparison tables.
PHP Documentation Group EMPTY(3)