home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- organization: Micropen Direct Writing Systems, Pittsford, NY
- subject: v10i046: Christmas warning shell script
- from: steve@micropen (...rochester!ur-valhalla!micropen!steve)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 10, Issue 46
- Submitted-by: steve@micropen (...rochester!ur-valhalla!micropen!steve)
- Archive-name: christmas.sh
-
- [I've heard of people who like to start early, but---! ++bsa]
-
- Sorry if this isn't in the proper format for this sort of thing.
- It's my first time, so be gentle. |-)
-
- Now that the holidays are over, and people are starting to look
- forward to next Christmas, I thought the following little shell script might
- come in handy.
-
- #! /bin/sh
- # This file was wrapped with "dummyshar". "sh" this file to extract.
- # Contents: christmas.sh
- echo extracting 'christmas.sh'
- if test -f 'christmas.sh' -a -z "$1"; then echo Not overwriting 'christmas.sh'; else
- sed 's/^X//' << \EOF > 'christmas.sh'
- Xnow=`date '+%j'` # Time from New Years to now.
- Xnow=`expr $now + 6` # Add six days between Christmas and New Years.
- Xif [ $now -gt 366 ]
- Xthen
- X now=`expr $now - 366` # After Christmas, adjust until New Years.
- Xfi
- Xecho "\nOnly `expr 366 - $now` days until Christmas!\n"
- EOF
- chars=`wc -c < 'christmas.sh'`
- if test $chars != 265; then echo 'christmas.sh' is $chars characters, should be 265 characters!; fi
- fi
- exit 0
-
- These lines added into your .profile, .login, etc, can keep you
- informed as to how many more days you have to shop before next Christmas
- rolls around, just like the big department stores do!
-
- I tested this under sh(1) and it ran ok, so there shouldn't be
- too many problems. Feel free to embelish as you need to get the point
- across!
-
- Why wait until next fall. Start now!
-
- Remind yourself! Remind your friends! |-)
-
- Have fun.
-
-
- SJO
-
- ================================================================================
- --
- " Women: " Steve Owens @ Micropen, Inc.
- " Fear them. " Pittsford, N.Y. 14534
- -- Opus micropen!steve@ee.rochester.edu
-
-
-