hello
whats the difference between excuting a shell script as
a)sh myscript.sh
b). ./myscript.sh
i noticed that my shell script works fine when i run it as . ./myscript
.sh but fails when i run it as sh myscript.sh could anybody explain why.
the shell script is very simple
... (9 Replies)
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)
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)
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)
Hi Guys,
iīve a question ... but itīs a litte bit tricky:
iīve a 3 php-scripts which runīs via cron at night. These script reads an xml-file a writes it in an MySQL-DB.
I named them (for example here ) Script1 - Script3. The XML-Files i named xml1 - xml3.
Now, iīve build a Batch-file,... (10 Replies)
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)
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)
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)
Hello.
In the following :
RESTORE_FF contain a file name : a_file.tar.gz
I am testing in a directory if "a_file.tar.gz" exists and or if any file like "a_file.tar.gz" exists.
So "a_file.tar.gz" will give me file exists
So "a_file.tar.gz." will give me file exists
So... (5 Replies)
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
LEARN ABOUT PHP
datefmt_set_lenient
DATEFMT_SET_LENIENT(3) 1 DATEFMT_SET_LENIENT(3)IntlDateFormatter::setLenient - Set the leniency of the parser
Object oriented style
SYNOPSIS
public bool IntlDateFormatter::setLenient (bool $lenient)
DESCRIPTION
Procedural style
bool datefmt_set_lenient (IntlDateFormatter $fmt, bool $lenient)
Define if the parser is strict or lenient in interpreting inputs that do not match the pattern exactly. Enabling lenient parsing allows
the parser to accept otherwise flawed date or time patterns, parsing as much as possible to obtain a value. Extra space, unrecognized
tokens, or invalid values ("February 30th") are not accepted.
PARAMETERS
o $fmt
- The formatter resource
o $lenient
- Sets whether the parser is lenient or not, default is TRUE (lenient).
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
datefmt_set_lenient(3) example
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'dd/MM/yyyy'
);
echo 'lenient of the formatter is : ';
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
datefmt_parse($fmt, '35/13/1971');
echo "
Trying to do parse('35/13/1971').
Result is : " . datefmt_parse($fmt, '35/13/1971');
if (intl_get_error_code() != 0) {
echo "
Error_msg is : " . intl_get_error_message();
echo "
Error_code is : " . intl_get_error_code();
}
datefmt_set_lenient($fmt, false);
echo "
Now lenient of the formatter is : ";
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
datefmt_parse($fmt, '35/13/1971');
echo "
Trying to do parse('35/13/1971').
Result is : " . datefmt_parse($fmt, '35/13/1971');
if (intl_get_error_code() != 0) {
echo "
Error_msg is : ".intl_get_error_message();
echo "
Error_code is : ".intl_get_error_code();
}
?>
Example #2
OO example
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'dd/MM/yyyy'
);
echo 'lenient of the formatter is : ';
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
$fmt->parse('35/13/1971');
echo "
Trying to do parse('35/13/1971').
Result is : " . $fmt->parse('35/13/1971');
if (intl_get_error_code() != 0) {
echo "
Error_msg is : " . intl_get_error_message();
echo "
Error_code is : " . intl_get_error_code();
}
$fmt->setLenient(FALSE);
echo "
Now lenient of the formatter is : ";
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
$fmt->parse('35/13/1971');
echo "
Trying to do parse('35/13/1971').
Result is : " . $fmt->parse('35/13/1971');
if (intl_get_error_code() != 0) {
echo "
Error_msg is : " . intl_get_error_message();
echo "
Error_code is : " . intl_get_error_code();
}
?>
The above example will output:
lenient of the formatter is : TRUE
Trying to do parse('35/13/1971').
Result is : 66038400
Now lenient of the formatter is : FALSE
Trying to do parse('35/13/1971').
Result is :
Error_msg is : Date parsing failed: U_PARSE_ERROR
Error_code is : 9
SEE ALSO datefmt_is_lenient(3), datefmt_create(3).
PHP Documentation Group DATEFMT_SET_LENIENT(3)