hi all,
how do i get the month in single digit in ksh script ?? my command for date is :
/usr/bin/date +%Om/%Oe/%y | sed 's/ //g'
which returns "01/16/09" but i need the output to be "1/16/09" i.e the month without leading zero.
thanks in advance.
/usr/bin/date +%m/%Oe/%y | sed 's/^0//g'
If you have GNU date:
date +%-m/%e/%y
Otherwise:
date=$( date +%m/%e/%y )
echo "${date#0}"
(Though I can't imagine why anyone would want a date in such an illigocal and ambiguous format!)