Translating #!/bin/ksh date conversion function into #!/bin/sh
问题 I used this ksh function for converting "1-Jan-2011" format to "1.1.2011." #!/bin/ksh ##---- function to convert 3 char month into numeric value ---------- convertDate() { echo $1 | awk -F"-" '{print $1,$2,$3}' | read day mm yyyy ## split the date arg typeset -u mmm=`echo $mm` ## set month to uppercase typeset -u months=`cal $yyyy | grep "[A-Z][a-z][a-z]"` ## uppercase list of all months i=1 ## starting month for mon in $months; do ## loop thru month list ## if months match, set numeric month