- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Report script
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
Discussions
Discussions
Forums
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
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
тАО11-08-2010 02:13 AM
тАО11-08-2010 02:13 AM
Re: Report script
I made the following modification but it does not work.
I donot see the file in /tmp
what have i done wrong?
#!/usr/bin/ksh
function get_first_sunday
{
typeset month=$1 year=$2
typeset -Z02 first_sunday=$( cal $month $year | awk 'NR == 3 { print $NF }' )
print "Sun" $year $month $first_sunday
}
function get_other_day
{
typeset month=$1 year=$2
typeset -Z02 other_day=$( cal $month $year )
print "other" $year $month $other_day
}
typeset wday month year
typeset -Z02 mday
date +'%a %m %e %Y' | read wday month mday year
typeset first_sunday_of_the_year=$( get_first_sunday 01 $year )
typeset first_sunday_of_june=$( get_first_sunday 06 $year )
typeset first_sunday_of_the_month=$( get_first_sunday $month $year )
typeset other_day=$( get_other_day $month $year )
echo "$other_day"
echo $first_sunday_of_the_year
echo $first_sunday_of_june
echo $first_sunday_of_the_month
case "$wday $year $month $mday" in
"$first_sunday_of_the_year")
echo "First sunday of the year" > /tmp/First_year.txt
;;
"$first_sunday_of_june")
echo "First sunday of June" > /tmp/First_june.txt
;;
"$first_sunday_of_the_month")
echo "First sunday of the month" > /tmp/First_month.txt
;;
"$other_day")
echo "Other" > /tmp/otherday.txt
;;
Sun*)
echo "Other" > /tmp/sunday.txt
;;
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2010 02:44 AM
тАО11-08-2010 02:44 AM
Re: Report script
*) echo "no match $other_day" ;;
There may be a spacing problem in your get_other_day function? Also how does the string "other" ever match $wday?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2010 02:53 AM
тАО11-08-2010 02:53 AM
Re: Report script
I am new to this and just when i thought i understood i found i did not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2010 02:58 AM
тАО11-08-2010 02:58 AM
Re: Report script
To get a match in the case, these strings must match:
echo "$wday $year $month $mday"
echo "$other_day"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2010 03:08 AM
тАО11-08-2010 03:08 AM
Re: Report script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2010 03:08 AM
тАО11-08-2010 03:08 AM
Re: Report script
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2010 10:39 PM
тАО11-08-2010 10:39 PM
Re: Report script
You can of course use a wildcard at the end of your case that matches all other cases:
*)
echo "Other" > /tmp/otherday.txt ;;
And remove your "$other_day" case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2010 10:45 PM
тАО11-08-2010 10:45 PM
Re: Report script
- « Previous
-
- 1
- 2
- Next »