Hi All
I have a shell script which calls all the Teradata Utiltyes . There is a sudden change in the requirment .
What i'm asked to do is
pass on the DATE to the shell script which should take the date automatically and run the utilityes.
i.e. the date should not be passed on manulay.The date should be taken automatically.
Please suggest me something on this.
Thanks,
Vinay
whats the date format that your script takes??
can you post the script??
The date parameter is something like this
'20050101',20080101.
Irrespective of the date is correct or not we take the date with an intreval of 3 years.But that is the date format like
"yyyymmdd".
Please suggest me something
thanks,
Vinay
Ikon
4
Is this what you are looking for?
# date '+%Y%m%d'
20081209
# date --date='-3 years' '+%Y%m%d'
20051209
# date --date='3 years' '+%Y%m%d'
20111209
But will the shell script take the DATE automatically , If this condition is passed. I mean to ask is i dont want give the date maually.
When i run the script,it should take the date automatically.
Ikon
6
TODAY=`date '+%Y%m%d'`
YEARSAGO=`date --date='-3 years' '+%Y%m%d'`
echo "Today: $TODAY 3 Years Ago: $YEARSAGO"
# sh test.sh
Today: 20081209 3 Years Ago: 20051209