05-07-2008
Snytax error on If Statement--help
year=`date '+%Y'`
month=`date '+%m'`
day=`date '+%d'`
day=`expr $day - 1`
case $month in
1 | 3 | 5 | 7 | 8 | 10 | 12);;
if($day =7 ); then
$day=6
fi
4 | 6 | 9 | 11);;
if [ $day = 0 ] ; then
$day=31
fi
2);;
if [ $day = 0 ] ; then
if [ `expr $year % 4` -eq 0]; then
$day = 28
else
$day = 29
fi
fi
*) echo error: too many arguments 1>&2 ;;
esac
DATE=$year$month$day
cp $HOME/*$DATE*.log $HOME/QVGLog
cd $HOME/QVGLog
gzip *
the error message is
./call: line 9: syntax error near unexpected token `('
./call: line 9: `if($day =7 ); then'
Pls help, i've checked the syntax for if else statement on web, but cant fix it.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello,
I am trying to parse an error returned by a command inside the if statement but it is just displays the full error instead and then stops.
if ; then
echo "no such package"
else
echo "similar version found will use pkgrm"
fi
the above code just displays
please let me know... (2 Replies)
Discussion started by: rakeshou
2 Replies
2. Shell Programming and Scripting
:b:hi,
I have a script as given below:
pr_det="1"
if
then
awk ' BEGIN {printf("%23s","session")}' >> report.txt
awk ' BEGIN {printf "\n"} ' >> report.txt
else
awk ' BEGIN {printf("%55s","file_dsc")} ' >> report.txt
awk ' BEGIN {printf("%101s","no_recs")} '... (1 Reply)
Discussion started by: jisha
1 Replies
3. Linux
Hi ,
I am getting an error when I run the script for checking word "view" in a file . I am using if statement. like this
if
then
VW_VAR=` cat $TN.${ecmdate}.sql1 | grep -i view | awk '{print $3}' | cut -d '.' -f2 `
echo " VW_$VW_VAR "
sed -e... (16 Replies)
Discussion started by: capri_drm
16 Replies
4. Shell Programming and Scripting
HI i am getting error while executing the given statement
for filename in `cat a/file.lst`
do
if then
echo "Exit Code Description :File $filename - is missing in Input Directory" >a.log
exit
else
count1=`awk 'END {print NR}' $filename`
echo "$count1">>a.log
count2=`awk 'END {print... (4 Replies)
Discussion started by: ravi214u
4 Replies
5. Shell Programming and Scripting
hi,
When i try to run the code below, i get the following error
"ksh: syntax error: `(' unexpected"
i am not able to figure it out. Can anyone help me?
Code: (2 Replies)
Discussion started by: ragavhere
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
This is my script to catch any oracle errors.
In this, the $sqlerr returns
ORA-01017: invalid username/password; logon denied
when i specify wrong username/password
the if condition is failing. how can i resolve the issue.
the if statement gives error
sqloutput=`sqlplus -s -L... (1 Reply)
Discussion started by: Swapna173
1 Replies
7. Shell Programming and Scripting
I am working on script for stale nfs.
the file consists of
cat data01stale.log
- - - - /abcd/backup
- - - - /abcd/data
Script (16 Replies)
Discussion started by: nareshkumar522
16 Replies
8. Shell Programming and Scripting
Hi
Can you please tell me what is wrong with this line:
if && ]; then
basically i want to check if x = 12 and F (Filename) end with 'g'. But it is throwing syntax error. (7 Replies)
Discussion started by: rtagarra
7 Replies
9. Shell Programming and Scripting
Can anybody tell the correct way to use the following awk pattern check within an if statement?
When I run this command outside of the if statement
cat /tmp/test2.out | awk -v T=$TIME -v G=$GROUP -v C=$CDATE '$0 ~ T && $0 ~ G && $0 ~ C' | grep -i "Starting the group"
I get the following... (0 Replies)
Discussion started by: kieranfoley
0 Replies
10. UNIX for Beginners Questions & Answers
hello all
im new to unix and when i use below script i get an error :
#! /bin/bash
Echo -e "enter the name of the file : \c"
read file_name
if
then
echo "$file_name found"
else
echo "$file_name not found"
fi
running the script i get below error :
$ ./hello (26 Replies)
Discussion started by: Ibrahims1
26 Replies
LEARN ABOUT DEBIAN
html::formhandler::field::date
HTML::FormHandler::Field::Date(3pm) User Contributed Perl Documentation HTML::FormHandler::Field::Date(3pm)
NAME
HTML::FormHandler::Field::Date - a date field with formats
VERSION
version 0.40013
SUMMARY
This field may be used with the jQuery Datepicker plugin.
You can specify the format for the date using jQuery formatDate strings or DateTime strftime formats. (Default format is format =>
'%Y-%m-%d'.)
d - "%e" - day of month (no leading zero)
dd - "%d" - day of month (two digit)
o - "%{day_of_year}" - day of the year (no leading zeros)
oo - "%j" - day of the year (three digit)
D - "%a" - day name short
DD - "%A" - day name long
m - "%{day_of_month" - month of year (no leading zero)
mm - "%m" - month of year (two digit) "%m"
M - "%b" - month name short
MM - "%B" - month name long
y - "%y" - year (two digit)
yy - "%Y" - year (four digit)
@ - "%s" - Unix timestamp (ms since 01/01/1970)
For example:
has_field 'start_date' => ( type => 'Date', format => "dd/mm/y" );
or
has_field 'start_date' => ( type => 'Date', format => "%d/%m/%y" );
You can also set 'date_end' and 'date_start' attributes for validation of the date range. Use iso_8601 formats for these dates ("yyyy-mm-
dd");
has_field 'start_date' => ( type => 'Date', date_start => "2009-12-25" );
Customize error messages 'date_early' and 'date_late':
has_field 'start_date' => ( type => 'Date,
messages => { date_early => 'Pick a later date',
date_late => 'Pick an earlier date', } );
If form has 'is_html5' flag active it will render <input type="date" ... /> instead of type="text"
AUTHOR
FormHandler Contributors - see HTML::FormHandler
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Gerda Shank.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-25 HTML::FormHandler::Field::Date(3pm)