I have the question:
How return the exit code from then assign :
VAR=$(command ) for ex. VAR=$(ls ....)
VAREXIT=$?
echo $VAREXIT
VAREXIT is equal to 0 if the directory exist or not exist. WHI??
if i execute the command direct from line-command , the value of $? is different if... (1 Reply)
Hi all
I'm trying to evalute the return status of a function without much success. I've put a very basic example below to explain.
check_ok() works fine but when used within an if statement, it always returns true, whether it is true or false. I'm guessing it returns true as the function... (4 Replies)
Hi,
I am using /bin/sh. I want to display the stdout and stderr on the terminal as well as save it in a file, so I'm using this command.
gmake all 2>&1 | tee log
But even if gmake fails, it's always giving 0 as exit status, i suppose because of tee.
# false 2>&1 | tee Log
# echo $?
0... (2 Replies)
Hi all,
My kshell code is not working, when I use a function to return something. But when I use the same function as without returning any values, it is working. Pls help me here.
Code1 :
func1 () {
y=`echo $x | grep XXX| cut -f 2 -d ' '`
if ; then
exit 100
... (2 Replies)
Hi,
I just want to exit from function if some condition doesnt meet then control should go back to main program and start running from where it left..
When i used "exit" inside the function, its simply exited from entire script and it didnt run anymore.. Any idea how to do this..
Thanks... (3 Replies)
Hi,
Is there a way to exit from a subcommand, which is a function in my example below?
#!/bin/ksh
function exitFunction {
if ]; then
echo "success"
elif ]; then
echo "failed"
exit 1 # the exit problem
fi
exit 0
}
... (2 Replies)
Below is my script that is function properly per my conditions but I am facing one problem here that is when one function fails then Iy should not check other functions but it calls the other function too So anyone can help me how could i achieve this?
iNOUT i AM GIVING TO THE... (1 Reply)
Hello, this is my first post here.
I'm attempting to write a bash shell script to rm the contents of a directory without deleting the directory, specifically in OS X 10.10 . Here's what I have:
function clear() {
USER="$USER"
DIR=$1
rm -rfv /Users/"$USER"/library/$DIR/*
}
clear... (6 Replies)
Not sure where the problem is. I can run the script without any issue using the following command.
. /opt/app/scripts/cdc_migration.sh
But it fails with the below error when I try it this way
/opt/app/scripts/cdc_migration.sh
/opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies
LEARN ABOUT PHP
forward_static_call_array
FORWARD_STATIC_CALL_ARRAY(3) 1 FORWARD_STATIC_CALL_ARRAY(3)forward_static_call_array - Call a static method and pass the arguments as arraySYNOPSIS
mixed forward_static_call_array (callable $function, array $parameters)
DESCRIPTION
Calls a user defined function or method given by the $function parameter. This function must be called within a method context, it can't
be used outside a class. It uses the late static binding. All arguments of the forwarded method are passed as values, and as an array, sim-
ilarly to call_user_func_array(3).
PARAMETERS
o $function
- The function or method to be called. This parameter may be an array, with the name of the class, and the method, or a string,
with a function name.
o $parameter
- One parameter, gathering all the method parameter in one array.
Note
Note that the parameters for forward_static_call_array(3) are not passed by reference.
RETURN VALUES
Returns the function result, or FALSE on error.
EXAMPLES
Example #1
forward_static_call_array(3) example
<?php
class A
{
const NAME = 'A';
public static function test() {
$args = func_get_args();
echo static::NAME, " ".join(',', $args)."
";
}
}
class B extends A
{
const NAME = 'B';
public static function test() {
echo self::NAME, "
";
forward_static_call_array(array('A', 'test'), array('more', 'args'));
forward_static_call_array( 'test', array('other', 'args'));
}
}
B::test('foo');
function test() {
$args = func_get_args();
echo "C ".join(',', $args)."
";
}
?>
The above example will output:
B
B more,args
C other,args
SEE ALSO forward_static_call(3), call_user_func(3), call_user_func_array(3), is_callable(3), information about the callback type.
PHP Documentation Group FORWARD_STATIC_CALL_ARRAY(3)