Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
# File-name: last_month.sh
#--------------------------------------
# Returns the last month
#--------------------------------------
# Input: Default:
# $1 - mm Current month
# $2 - yyyy Current year
#--------------------------------------
#This is how I define a function in UNIX
#shell scripts
get_one_day_before_specified_date()
{
# get the command line input (date,month & year)
month=$1
year=$2
# if it is the first month of the year
if [ $month -eq 01 ]
then
# make the month as 12
month=12
# deduct the year by one
year=`expr $year - 1`
else
# deduct the month by one
month=`expr $month - 1`
fi
typeset -Z2 month=${month}
echo $month $year
}
#!/bin/ksh
if [ $# -ne 2 ]
then
m=`date +%m`
y=`date +%Y`
else
m=$1
y=$2
fi
get_one_day_before_specified_date $m $y
typeset -Z2 month=${month}
echo $month $year
case $month in
1) mon="Jan";;
2) mon="Feb";;
3) mon="Mar";;
4) mon="Apr";;
5) mon="May";;
6) mon="Jun";;
7) mon="Jul";;
8) mon="Aug";;
9) mon="Sep";;
10) mon="Oct";;
11) mon="Nov";;
12) mon="Dec";;
esac
echo $mon $year