Write a shell script to find whether the first day of the month is a working day


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Write a shell script to find whether the first day of the month is a working day
# 1  
Old 03-17-2005
Write a shell script to find whether the first day of the month is a working day

Hi ,
I am relatively new to unix...
Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell..

This is very urgent.
Thanks for ur help...
# 2  
Old 03-17-2005
Hello,

Do you want to get the output of the current month or any month that you give..
Please make the needed thing clear..

Thanks
esham
# 3  
Old 03-17-2005
'Write a shell script to find whether the first day of the month is a working day'

Hi Esham,
The script runs every day.....
So it should be for any month.....

Thanks ...
# 4  
Old 03-17-2005
Look at "Yesterdays Date/Date Arithmetic" in our FAQ section.
# 5  
Old 03-17-2005
Quote:
Originally Posted by phani
Hi ,
I am relatively new to unix...
Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell..

This is very urgent.
Thanks for ur help...
man cal
or
man date
# 6  
Old 03-17-2005
Using case...
Code:
case $(date "+%a%d") in
    Mon01|Tue01|Wed01|Thu01|Fri01) echo true ;;
    *) echo false ;;
esac

# 7  
Old 03-18-2005
Quote:
Originally Posted by Ygor
Using case...
Code:
case $(date "+%a%d") in
    Mon01|Tue01|Wed01|Thu01|Fri01) echo true ;;
    *) echo false ;;
esac

thats a good solution...

and its simple also...

esham SmilieSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Julian day to dates in YEAR-MONTH-DAY

hello, I have many files called day001, day002, day003 and I want to rename them by day20070101, day20070102, etc. I need to do it for several years and leap years as well. What is the best way to do it ? Thank you. (1 Reply)
Discussion started by: Ggg
1 Replies

2. Shell Programming and Scripting

Find Month first Working Day

Hi, I would like to calculate 1st working/Business day of each month. Exp: 1st -Oct-2011 is Saturday--- Non Business Day So the Next Working Day would be 3-Oct-2011 I need a shell script to calculate the month first business date. (3 Replies)
Discussion started by: koti_rama
3 Replies

3. UNIX for Dummies Questions & Answers

Running Script via Crontab on 2nd Working day each month

Hello Guys, I have a questions regarding running a shell script every second working day each month. I have no clue how solve this problem :wall:. Important is that it has to be the second working (Mo-Fr). Example: If 1st and 2nd Days of month are Sat and Sun the script must run on 4th day... (5 Replies)
Discussion started by: Hollo
5 Replies

4. Shell Programming and Scripting

Script to counting a specific word in a logfile on each day of this month, last month etc

Hello All, I am trying to come up with a shell script to count a specific word in a logfile on each day of this month, last month and the month before. I need to produce this report and email it to customer. Any ideas would be appreciated! (5 Replies)
Discussion started by: pnara2
5 Replies

5. Shell Programming and Scripting

how to find the second business day of month

I want to decide is that today is larger than the second business day of this month, who can i find second business day of this month? (3 Replies)
Discussion started by: qjlongs
3 Replies

6. Shell Programming and Scripting

How to find the first working day of month ?

Hi, How to find the first working day of month ? My requirement is, I need to call the function only if today is first working day of month. I could find out one function which finds last working day in month in this forum. Can anyone pls let me know for first working day. Thanks. for... (10 Replies)
Discussion started by: vnimavat
10 Replies

7. Shell Programming and Scripting

Code creates day 32 instead of 1st day of next month.

I am using the code below modified from a post I saw here regarding having the script write out future dates. The problem is that instead of making 8/1 it makes 7/32! Please help! yy=`date +%Y` mm=`date +%m` dd=`date +%d` echo "Today is : $yy $mm $dd" #!/usr/bin/ksh date '+%m... (5 Replies)
Discussion started by: libertyforall
5 Replies

8. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

9. Shell Programming and Scripting

last working day of previous month

Hi, I want a script(ksh) to see if today is the last working day(Mon-Fri) of the month. If it is the last working day I need to print current date, else I need the last working day of previous month. Thanks in advance. (1 Reply)
Discussion started by: rspk_praveen
1 Replies

10. Shell Programming and Scripting

Get Last working day of the month

Hi I need a script to get "Last working day of the month". I will pass the month and year as parameters and i need to get the last working date. Ex for June 2008 the last working day is 30th its monday. for August 2008 the last working day is 29th and it is Friday. ie the last working... (6 Replies)
Discussion started by: manmarirama
6 Replies
Login or Register to Ask a Question