home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume5 / aff < prev    next >
Internet Message Format  |  1989-02-03  |  5KB

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