12-03-2008
The $? value in your script is coming from the preceding successful "echo" statement.
If you want to see the reply from "test", try:
test -s $DD_INDD ; ERROR=$?
Then check the reply value in $ERROR.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a TEST.dat file. As a clean up process, I have to delete the TEST.dat file if it is empty. Basically, I don't want to delete TEST.dat if it contains anything in it but want to delete TEST.dat if it contains any spaces or nothing in it.
Is there a command to check if the file... (2 Replies)
Discussion started by: rkumar28
2 Replies
2. UNIX for Advanced & Expert Users
Hi,
I need your help.
How can I create an empty filename with a specific size, in hp-ux?
Regards,
Mizi (2 Replies)
Discussion started by: Mizi
2 Replies
3. Shell Programming and Scripting
How do I check to make sure a file is not zero bytes?
Something like:
if
then
????? (7 Replies)
Discussion started by: lesstjm
7 Replies
4. UNIX for Dummies Questions & Answers
hi all:
my solaris FIND does not support
find myFolder -type d -empty
how can i find the empty folders?
thanks! (7 Replies)
Discussion started by: lasse
7 Replies
5. Shell Programming and Scripting
hi
how can I determine, if a file is empty or not?I am using read line clause.
The script should be like:
while read line
do
if(file is empty) then;
......
done < $blacklist (1 Reply)
Discussion started by: tjay83
1 Replies
6. Shell Programming and Scripting
how can i use while loop ?
while file is empty do....
if not empty do .....
in bash (1 Reply)
Discussion started by: Trump
1 Replies
7. Shell Programming and Scripting
I have a program that takes a file in which I use a sed to remove some data that is not needed. If all of the data is removed. I want to grep for that in the file and print that there is no data left in the file. When I use sed, I replace a word with nothing but it still seems to leave a return... (5 Replies)
Discussion started by: plawr
5 Replies
8. Shell Programming and Scripting
Hi All,
I have a piece of perl code in which I DON'T want to delete a file rather empty out the contents, here is the code -
if ( unlink("$opt_b") == 1 ) {
print_log( "$opt_b deleted", 1 );
}else {
print_log( "Could not delete $opt_b:$!", 1 );
... (5 Replies)
Discussion started by: jacki
5 Replies
9. Shell Programming and Scripting
Hi there,
I'm just starting out with shell scripting and I'm trying to make a test where the script will basically run yum check-update to find out if the server has any available and if it does it e-mails me but if not it will just stop there.
I have it working if there are actually... (7 Replies)
Discussion started by: Imnewtothis
7 Replies
10. UNIX for Dummies Questions & Answers
when I run the following command in AIX (bash),
find ./*
I get the following error.
find: bad status-- ./*
Thats becasuse, its an empty directory. The same works, when there the directory is not empty. Even though the find deesnt have to rerun any result.
My full find command would look... (4 Replies)
Discussion started by: deepakwins
4 Replies
EXIT(3) 1 EXIT(3)
exit - Output a message and terminate the current script
SYNOPSIS
void exit ([string $status])
DESCRIPTION
void exit (int $status)
Terminates execution of the script. Shutdown functions and object destructors will always be executed even if exit is called.
exit is a language construct and it can be called without parentheses if no $status is passed.
PARAMETERS
o $status
- If $status is a string, this function prints the $status just before exiting. If $status is an integer, that value will be used
as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and
shall not be used. The status 0 is used to terminate the program successfully.
Note
PHP >= 4.2.0 does NOT print the $status if it is an integer.
RETURN VALUES
No value is returned.
EXAMPLES
Example #1
exit example
<?php
$filename = '/path/to/data-file';
$file = fopen($filename, 'r')
or exit("unable to open file ($filename)");
?>
Example #2
exit status example
<?php
//exit program normally
exit;
exit();
exit(0);
//exit with an error code
exit(1);
exit(0376); //octal
?>
Example #3
Shutdown functions and destructors run regardless
<?php
class Foo
{
public function __destruct()
{
echo 'Destruct: ' . __METHOD__ . '()' . PHP_EOL;
}
}
function shutdown()
{
echo 'Shutdown: ' . __FUNCTION__ . '()' . PHP_EOL;
}
$foo = new Foo();
register_shutdown_function('shutdown');
exit();
echo 'This will not be output.';
?>
The above example will output:
Shutdown: shutdown()
Destruct: Foo::__destruct()
NOTES
Note
Because this is a language construct and not a function, it cannot be called using variable functions.
Note
This language construct is equivalent to die(3).
SEE ALSO
register_shutdown_function(3).
PHP Documentation Group EXIT(3)