08-12-2009
(sorry for my english)
i supose every of your scripts returns a code,
0 = Ok
1 = No ok
then yo can do:
if script1.sh params
then
....your code
if script2.sh params
then
..... your code....
else
echo "ERROR in script2.sh"
fi
else
echo "ERROR in script1.sh"
fi
------------------------
example with a command:
$more file
if cat $1
then
echo "cat execute OK"
else
echo "cat execute NO-OK"
fi
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a rather big script that i have written in ksh and it is falling over in two places with a 'test argument' error. I know this usually means that the if statement is not correct, but it is fine. I have looked through the rest of the script for any odd brackets or ` marks, but can't see... (2 Replies)
Discussion started by: handak9
2 Replies
2. Shell Programming and Scripting
Hi All,
I am new to shell scripting.
I have a variable which holds a numeric value.I have to check whether this variable holds a value between(0- 8),(8-17)(17-24).How do i write this syntax using if in shell scripting.
Thanks
Vignesh (2 Replies)
Discussion started by: vignesh53
2 Replies
3. Shell Programming and Scripting
Hello All,
I looking for a way to verify the correction of shell script syntax.
Is there any switch like -c in perl which do this in shell ?
Thank You. (1 Reply)
Discussion started by: Alalush
1 Replies
4. Shell Programming and Scripting
hello everyone
i am beginner on shell scripting .and i am working on my project work on ad hoc network
i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem "
syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies
5. Emergency UNIX and Linux Support
I want to delete archivelog files that has been archived and applied from primary database
to standby database. This piece of script is working in Linux server. However, I copy it to
Unix server with tiny modification. It won't work and generate the error message. I have checked
code carefullt... (8 Replies)
Discussion started by: duke0001
8 Replies
6. Shell Programming and Scripting
sorry but need help
http://i.investopedia.com/inv/articles/site/CalculationEMA.gif
trying to achieve ema
in script I have this syntax which errors
ema=` ;
the 0.153846154 ='s Smoothing Factor
really appreciate help (3 Replies)
Discussion started by: harte
3 Replies
7. Shell Programming and Scripting
I am trying to run a unix script in my home directory.Snippet below
echo "`date '+%Y%m%d_%H%M%S'` Getting ProductList.dat"
if ( -f $DIR/ProductList.dat) then
cp $DIR/ProductList.dat MigratedProductList.dat
else
echo "`date '+%Y%m%d_%H%M%S'`ProductList.dat does not exist; Processing... (4 Replies)
Discussion started by: Mary James
4 Replies
8. Shell Programming and Scripting
I am creating a shell script. In which, I need to get server name and server IP. I used this command in script.
servername=`cat /etc/hosts|grep `eval hostname`|awk '{print $2}'`
however, when execute script or put set -x to debug, it return:
line 13: syntax error at line 13: `|' unexpected... (4 Replies)
Discussion started by: duke0001
4 Replies
9. Shell Programming and Scripting
Hi Everyone,
Is there any way ( generic) to check syntax of Shell Scripts without running it?? (4 Replies)
Discussion started by: roy121
4 Replies
10. Shell Programming and Scripting
I want to make the file test condition a variable ($Prmshn in code below).
My goal is to use something like the first three unsuccessful if statetments since the 'if
#!/bin/ksh
test_input()
{
Prmshn=${1}
InFLNm=${2}
ifReq="-$Prmshn $InFLNm"
#the following three if statments fail:
#if ] ;... (10 Replies)
Discussion started by: ms63707
10 Replies
DEFINE(3) 1 DEFINE(3)
define - Defines a named constant
SYNOPSIS
bool define (string $name, mixed $value, [bool $case_insensitive = false])
DESCRIPTION
Defines a named constant at runtime.
PARAMETERS
o $name
- The name of the constant.
o $value
- The value of the constant; only scalar and null values are allowed. As of PHP 7 it also possible to use array value. Scalar val-
ues are integer, float, string or boolean values. It is possible to define resource constants, however it is not recommended and
may cause unpredictable behavior.
o $case_insensitive
- If set to TRUE, the constant will be defined case-insensitive. The default behavior is case-sensitive; i.e. CONSTANT and Con-
stant represent different values.
Note
Case-insensitive constants are stored as lower-case.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
CHANGELOG
+--------+---------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------+
| 7.0.0 | |
| | |
| | |
| | array values are allowed. |
| | |
+--------+---------------------------+
EXAMPLES
Example #1
Defining Constants
<?php
define("CONSTANT", "Hello world.");
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Constant" and issues a notice.
define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs "Hello you."
// Works as of PHP 7
define('ANIMALS', array(
'dog',
'cat',
'bird'
));
echo ANIMALS[1]; // outputs "cat"
?>
SEE ALSO
defined(3), constant(3), The section on Constants.
PHP Documentation Group DEFINE(3)