src/utils/qa/getLastMonth.csh 1.2
1.2 2009/04/11 00:37:03 rhead
Sourced new qaConfig file at the top. Changed -h hgwbeta lines to look for sql host stored in a variable, specified in the new qaConfig file.
Index: src/utils/qa/getLastMonth.csh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/getLastMonth.csh,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/utils/qa/getLastMonth.csh 11 Oct 2007 16:47:09 -0000 1.1
+++ src/utils/qa/getLastMonth.csh 11 Apr 2009 00:37:03 -0000 1.2
@@ -1,62 +1,63 @@
#!/bin/tcsh
+source `which qaConfig.csh`
#######################
#
# 10-08-07
# gets year and month of last month
#
# Robert Kuhn
#
#######################
set year=""
set month=""
set yearMonth=""
set lastMonth=""
if ( $#argv != 1 ) then
echo
echo " gets year and month of last month."
echo
echo " usage: go | YYYY-MM"
echo
exit 1
else
if ( $argv[1] == "go" ) then
set year=`date +%Y`
set month=`date +%m`
set yearMonth=`date +%Y-%m`
else
set yearMonth=$argv[1]
set year=`echo $yearMonth | awk -F- '{print $1}'`
set month=`echo $yearMonth | awk -F- '{print $2}'`
endif
endif
if ( $month > 12 ) then
echo "\n error. month out of range.\n"
exit 1
endif
# echo "year = $year"
# echo "month = $month"
# echo "yearMonth = $yearMonth"
# find last month
set lastMonth=`echo $month | awk '{print $1-1}'`
if ( $lastMonth == 0 ) then
set lastMonth=12
set year=`echo $year | awk '{print $1-1}'`
endif
if ( $lastMonth < 10 ) then
set lastMonth='0'$lastMonth
endif
# echo "year = $year"
# echo "lastMonth = $lastMonth"
echo $year-$lastMonth
exit