- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Date Question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2002 06:58 AM
02-28-2002 06:58 AM
I have written a script to generate a report for the given start date and end date. In the script I need to check whether the start date is Monday or not. Is there any readymade function or commands in shell script?.
Thanks in advance
Vasu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2002 07:02 AM
02-28-2002 07:02 AM
Re: Date Question
Try with "date +%A".
This will return the full
weekday in characters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2002 07:04 AM
02-28-2002 07:04 AM
Re: Date Question
Thu
# date +%A
Thursday
In your script you could do:
day = `date +%a`
Then if day = Mon do whatever you need to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2002 07:15 AM
02-28-2002 07:15 AM
SolutionAs usual my universal date hammer, caljd.sh, does this well. The -w option returns the day of the week, 0 - Sun; 6 - Sat.
For a given date:
DATE="3 4 2002" # March 4, 2002
WKDAY=$(caljd.sh -w ${DATE})
For today:
WKDAY=$(caljd.sh -w)
In either case,
if [ ${WKDAY} -eq 1 ]
then
echo "Monday Stuff"
else
echo "Not Monday Stuff"
fi
You can do a caljd.sh -u for full usage. P.S. It even knows about holidays.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2002 11:21 PM
02-28-2002 11:21 PM
Re: Date Question
Thanks everyone for ur suggestions. I wanted to assign points but the option was disabled. I don't know how to assign the points now.
Clay
Your code is working fine and thats what I need.
Vasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2002 11:24 PM
02-28-2002 11:24 PM
Re: Date Question
Vasu