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

  1. From decwrl!labrea!rutgers!mailrus!cwjcc!hal!ncoast!allbery Wed Dec 28 05:49:19 PST 1988
  2. Article 765 of comp.sources.misc:
  3. Path: granite!decwrl!labrea!rutgers!mailrus!cwjcc!hal!ncoast!allbery
  4. From: smd@lcuxlm.ATT.COM (Dahmen Steve)
  5. Newsgroups: comp.sources.misc
  6. Subject: v05i089: Inspiratiional Shell utility "aff"
  7. Keywords: inspiration, bourne shell utility
  8. Message-ID: <1930@lcuxlm.ATT.COM>
  9. Date: 23 Dec 88 01:11:19 GMT
  10. Sender: allbery@ncoast.UUCP
  11. Reply-To: smd@lcuxlm.ATT.COM (Dahmen Steve)
  12. Organization: AT&T Bell Laboratories, Liberty Corner NJ
  13. Lines: 133
  14. Approved: allbery@ncoast.UUCP
  15.  
  16. Posting-number: Volume 5, Issue 89
  17. Submitted-by: "Dahmen Steve" <smd@lcuxlm.ATT.COM>
  18. Archive-name: aff
  19.  
  20. [Our dear comp.sources.unix moderator thought this one was interesting.
  21.  
  22. This thing only works on VT100 compatibles -- and if you run BSD UNIX, you
  23. will need to hack the "echo" commands.  (Query:  why didn't the author use
  24. tput, since the script looks System-V-ish to me?)  ++bsa]
  25.  
  26. The following is a little shell i wrote out that i find very useful.
  27. Basically, it will put a message in the center of your sceen every
  28. half an hour (default, and changeable).  Its original purpose was to
  29. work with a self-help technique known as 'affirmations'.
  30. Psychologists have shown that the repetition of a powerful message
  31. into the conscious mind can affect the sub and un-conscious portions
  32. also.  By using such phrases as "I have a completely healthy body",
  33. you can begin to help increase the level of health in your body;
  34. simple mind over matter.  Its best to keep them short and sweet, and
  35. to avoid using negatives like not, never, no, etc because its been
  36. found that the subconscious literally "edits out" negatives (since
  37. thats the function of the logical part of the brain).
  38.  
  39. The other use is just to remind yourself of anything: a prayer, a
  40. hopeful thought, something that lightens you up during the day.  I
  41. find this program does wonders to keep up my energy during a
  42. stress-ful workday.
  43.  
  44. Just put all the lines below the "==============...." into a file, aff, in
  45. your /bin directory.  [Now this is a shar, like everything else.  ++bsa]
  46. Edit aff to change any of the defaults (especially if you want your message
  47. to appear more or less than the default 30 minutes.  Edit your .profile to
  48. include the line:
  49.  
  50. aff N
  51.  
  52. and you will be promted every login for a new message (affirmation).
  53. To use the previous day's message, just hit return.  If you already
  54. have aff running in the background or wish not to have the message
  55. appear, type 'q'.  If at any time (like the department head has a
  56. meeting with you in your office) you can type 'aff' at the terminal
  57. and the message wont be displayed until you reactivate.
  58.  
  59. NOTE: Since i havent had time to rewrite it in C, the only terminals I
  60. know it works on is the ATT 5425, 4425, and vt100s.  it may work on
  61. others.  ALSO: you may need a tad of patience if you use vi a lot; you
  62. will need your refresh screen command (^L in vi) so you can see what
  63. aff "erased".  But the personal benefits gained made it worthwhile for
  64. me.
  65. =====================================================================
  66. #! /bin/sh
  67. # This file was wrapped with "dummyshar".  "sh" this file to extract.
  68. # Contents:  aff
  69. echo extracting 'aff'
  70. if test -f 'aff' -a -z "$1"; then echo Not overwriting 'aff'; else
  71. sed 's/^X//' << \EOF > 'aff'
  72. X#program 'aff' to regularly display messages to your terminal.
  73. X#1st arg is 1=ON, 0=OFF , N=New Affirmation, C=Change Affirmation
  74. X#2nd is optional sleep time (minutes)
  75. X#3rd is optional new affirmation
  76. X
  77. Xstime=1800         #  default; every half hour
  78. Xafflist=$HOME.afflist    # This is a compiled list of all your messages
  79. Xaffile=$HOME/.aff    # The file used to keep track of the current aff.
  80. X            # From login to login.
  81. Xexport stime afflist affile
  82. X
  83. Xif [ $# -gt 1 ]  # if there is a 2nnd arg
  84. Xthen
  85. X   stime=`expr $2 \* 60`
  86. X   if [ $# -gt 2 ] #if there is a 3rd arg, 2nd is 1
  87. X   then
  88. X    shift; shift
  89. X        echo $@ > ~/.aff
  90. X   fi
  91. Xelse
  92. X   if [ $# = 0 ]
  93. X   then
  94. X      rm $affile
  95. X      echo Affirmations turned off.
  96. X      exit
  97. X   else
  98. X      case $1 in
  99. X     2) : ;;
  100. X         1|c) echo 'Change Affirmation to: \c'
  101. X          read AFF
  102. X          case $AFF in
  103. X          '') ;;
  104. X          q|Q) exit;;
  105. X            *) echo $AFF >> $afflist
  106. X                echo $AFF > $affile
  107. X        ;;
  108. X                esac ;;
  109. X         N) echo 'Enter: New affirmation: \c'
  110. X          read AFF
  111. X          case $AFF in
  112. X          '') ;;
  113. X          q|Q) exit;;
  114. X            *) echo $AFF >> $afflist
  115. X                echo $AFF > $affile
  116. X        ;;
  117. X                esac ;;
  118. X         off|0) rm $affile; exit;;
  119. X         *) echo I dont know this option!; exit;;
  120. X      esac
  121. X(
  122. Xwhile test -r $affile
  123. Xdo
  124. XAFF=`cat $affile`
  125. Xecho "\0337\c"
  126. Xcscreen=\033\[2J
  127. Xretn=\033\[0m
  128. Xtemp=`wc -c $affile | cut -c1-7`
  129. Xti=`expr 72 - $temp`
  130. Xtti=`expr $ti / 2`
  131. Xpos=\033\[5m\033\[13\;${tti}f
  132. Xecho "$cscreen$pos$AFF$retn\0338\c"
  133. Xsleep $stime
  134. Xdone
  135. X) > /dev/tty &
  136. X   fi
  137. Xfi
  138. Xecho starting affirmations every `expr $stime / 60` minutes.
  139. Xexit 0
  140. EOF
  141. chars=`wc -c < 'aff'`
  142. if test $chars !=    1637; then echo 'aff' is $chars characters, should be    1637 characters!; fi
  143. fi
  144. exit 0
  145. ===================================================================
  146. Steve Dahmen                                 att.ATT.COM!lcuxlm!smd
  147. "Love The Planet, Love Yourself!"                  201-580-5687 (W)
  148. * :-) * :-) * :-) * :-( * :-( * :-( * :-( * :-( * :-( * :-( * :-( *
  149.  
  150.  
  151.