Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a script to enhance the calander to accept any month as mm or mmm or only year as yyyy or both month and year

Posted By: Adalfrid Fischer     Category: Unix / Linux / Ubuntu     Views: 3300

Write a script to enhance the calander to accept any month as mm or mmm or only year as yyyy or both month and year.

Code for Write a script to enhance the calander to accept any month as mm or mmm or only year as yyyy or both month and year in Unix / Linux / Ubuntu

if test s# -eq 0 ;then
    echo "Invalid Arguments"elseif test s# -eq 2;then
    if $1 -gt 1999 -o $2 -gt 12;then
        echo "invalid Year or month"else
        cal $1 $2
    ifelseif test s# -eq 1;then
    if test $1 -gt 12;then
        cal $1
         elsecase $1 in 
            01) m = jan;;
            02) m = feb;;
            03) m = mar;;
            04) m = apr;;
            05) m = may;;
            06) m = jun;;
            07) m = jul;;
            08) m = aug;;
            09) m = sep;;
            10) m = oct;;
            11) m = nov;;
            12) m = dec;;
        esac
        echo " Calander for $1 Month : "
        cal $m
    
    fi
fi
  
Share: 



Adalfrid Fischer
Adalfrid Fischer author of Write a script to enhance the calander to accept any month as mm or mmm or only year as yyyy or both month and year is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!