search

Loading
Showing posts with label shell scripting. Show all posts
Showing posts with label shell scripting. Show all posts

Wednesday, June 5, 2013

How to run bash script in debug mode

Running the bash script in debug mode help us understand what is going on in the script before getting the output. This also help us find why our program didn't run if there is any issue.

It is just like step by step processing of the bash program.

We can use the below command to run the bash script in debug mode in run time.

Friday, February 8, 2013

Finding the first day and last day of the last month using date command in linux

First day of Last Month = echo $(date --date "-1 month" +%Y-%m-01)
Last day of Last Month = echo $(date --date "-`date +%d` days -0 month" +%Y-%m-%d)

First day of Current Month = echo $(date --date "-0 month" +%Y-%m-01)
Last day of Current Month = echo $(date --date "-`date +%d` days +1 month" +%Y-%m-%d)

First day of Next Month = echo $(date --date "+1 month" +%Y-%m-01)
Last day of Next Month = echo $(date --date "-`date +%d` days +2 month" +%Y-%m-%d)