I am using the below script to move two days back when script runs at starting two days of the year and also check first and second days of every month and move two days back.
if [$month="01"] && [$day="01"]; then
date="$last_month/$yes_day/$last_year"
fulldate="$last_month/$yes_day/$last_year"
else
if [$month="01"] && [$day="02"]; then
date="$last_month/$yes_day/$last_year"
fulldate="$last_month/$yes_day/$last_year"
else
if [ $day = "01" ]; then
date="$last_month/$yes_day/$year"
fulldate="$year$last_month$yes_day"
else
if [ $day = "02" ]; then
date="$last_month/$yes_day/$year"
fulldate="$year$last_month$yes_day"
else
date="$month/$yes_day/$year"
fulldate="$year$month$yes_day"
fi
fi
fi
fi
But my bad am getting the below error message
Etime_script.sh: line 19: [06=01]: command not found
Etime_script.sh: line 24: [06=01]: command not found
[
. Additionally, look into theelif
statement; it will help you clean things up. Also, the semicolons after the if statements are not necessary, but are also not incorrect, just strange. – Shawn J. Goff Jun 04 '14 at 14:14if [ ... ]; then
), so not that unusual. – goldilocks Jun 04 '14 at 14:18