home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume10 / christms.sh < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  2.4 KB

  1. From decwrl!dogie.macc.wisc.edu!uwm.edu!cs.utexas.edu!uunet!allbery Tue Jan 30 09:20:10 PST 1990
  2. Article 1316 of comp.sources.misc:
  3. Path: decwrl!dogie.macc.wisc.edu!uwm.edu!cs.utexas.edu!uunet!allbery
  4. From: steve@micropen (...rochester!ur-valhalla!micropen!steve)
  5. Newsgroups: comp.sources.misc
  6. Subject: v10i046: Christmas warning shell script
  7. Message-ID: <77899@uunet.UU.NET>
  8. Date: 28 Jan 90 18:32:33 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Organization: Micropen Direct Writing Systems, Pittsford, NY
  11. Lines: 54
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 10, Issue 46
  15. Submitted-by: steve@micropen (...rochester!ur-valhalla!micropen!steve)
  16. Archive-name: christmas.sh
  17.  
  18. [I've heard of people who like to start early, but---!  ++bsa]
  19.  
  20.     Sorry if this isn't in the proper format for this sort of thing.
  21. It's my first time, so be gentle.    |-)
  22.  
  23.     Now that the holidays are over, and people are starting to look
  24. forward to next Christmas, I thought the following little shell script might
  25. come in handy.
  26.  
  27. #! /bin/sh
  28. # This file was wrapped with "dummyshar".  "sh" this file to extract.
  29. # Contents:  christmas.sh
  30. echo extracting 'christmas.sh'
  31. if test -f 'christmas.sh' -a -z "$1"; then echo Not overwriting 'christmas.sh'; else
  32. sed 's/^X//' << \EOF > 'christmas.sh'
  33. Xnow=`date '+%j'`    # Time from New Years to now.
  34. Xnow=`expr $now + 6`    # Add six days between Christmas and New Years.
  35. Xif [ $now -gt 366 ]
  36. Xthen
  37. X    now=`expr $now - 366` # After Christmas, adjust until New Years.
  38. Xfi
  39. Xecho "\nOnly `expr 366 - $now` days until Christmas!\n"
  40. EOF
  41. chars=`wc -c < 'christmas.sh'`
  42. if test $chars !=      265; then echo 'christmas.sh' is $chars characters, should be      265 characters!; fi
  43. fi
  44. exit 0
  45.  
  46.     These lines added into your .profile, .login, etc, can keep you 
  47. informed as to how many more days you have to shop before next Christmas 
  48. rolls around, just like the big department stores do!
  49.  
  50.     I tested this under sh(1) and it ran ok, so there shouldn't be
  51. too many problems.  Feel free to embelish as you need to get the point 
  52. across!
  53.  
  54.     Why wait until next fall.  Start now!
  55.     
  56.     Remind yourself!  Remind your friends!        |-)
  57.  
  58.     Have fun.
  59.  
  60.  
  61.                             SJO
  62.  
  63. ================================================================================
  64. -- 
  65.   " Women: "                                  Steve Owens @ Micropen, Inc.
  66.   " Fear them. "                               Pittsford, N.Y. 14534
  67.   -- Opus                                       micropen!steve@ee.rochester.edu
  68.  
  69.  
  70.