home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume22
/
aff
/
part01
next >
Wrap
Text File
|
1991-08-17
|
6KB
|
181 lines
Newsgroups: comp.sources.misc
From: Steve Dahmen <smd@vab01.larc.nasa.gov>
Subject: v22i025: aff - Inspirational Shell utility, Part01/01
Message-ID: <1991Aug17.182102.7266@sparky.IMD.Sterling.COM>
X-Md4-Signature: 5e519aaa07e02791df21d3dc43bfcef6
Date: Sat, 17 Aug 1991 18:21:02 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: Steve Dahmen <smd@vab01.larc.nasa.gov>
Posting-number: Volume 22, Issue 25
Archive-name: aff/part01
Environment: tput, getopt
Supersedes: aff: Volume 5, Issue 89
The following is a little shell I wrote out that I find very useful.
Basically, it will put a message in the center of your sceen every
half an hour (default, and changeable). Its original purpose was to
work with a self-help technique known as 'affirmations'.
Psychologists have shown that the repetition of a powerful message
into the conscious mind can affect the sub and un-conscious portions
also. By using such phrases as "I have a completely healthy body",
you can begin to help increase the level of health in your body;
simple mind over matter. Its best to keep them short and sweet, and
to avoid using negatives like not, never, no, etc because its been
found that the subconscious literally "edits out" negatives (since
thats the function of the logical part of the brain).
The other use is just to remind yourself of anything: a prayer, a
hopeful thought, something that lightens you up during the day. I
find this program does wonders to keep up my energy during a
stress-ful workday.
Unshar this file and put aff, in your /bin directory. Edit aff to
change any of the defaults (especially if you want your message to
appear more or less than the default 30 minutes. Edit your .profile
to include the line:
aff N
and you will be promted every login for a new message (affirmation).
To use the previous day's message, just hit return. If you already
have aff running in the background or wish not to have the message
appear, type 'q'. If at any time (like the department head has a
meeting with you in your office) you can type 'aff' at the terminal
and the message wont be displayed until you reactivate.
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Steve Dahmen, Systems Analyst (804) 864-4519 (W)
Vigyan Research, Inc .- NASA Langley Research Center
Internet: smd@vab01.larc.nasa.gov
=====================================================================
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents: aff
# Wrapped by kent@sparky on Sat Aug 17 13:14:32 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive."'
if test -f 'aff' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'aff'\"
else
echo shar: Extracting \"'aff'\" \(2591 characters\)
sed "s/^X//" >'aff' <<'END_OF_FILE'
X#!/bin/sh
X# program 'aff' to regularly display messages to your terminal.
X# aff v 2.0 features:
X# Uses tput, so now it should run on any terminal terminfo knows about.
X# Now aff remembers your previous invocation's affirmation
X# No args means turn it off if its on, turn it on if its off!
X# Clears screen when you turn it off for those emergencies :-),
X# -q disables the autoclear
X# Now uses getopts and regular unix flag format.
X# Much more intuitive use.
X# Removed .afflist; just another . file to keep track of.
X
X# -n <new affirmation> to start it with a new affirmation
X# -c <new affirmation> to change affirmations while running
X# -t <sleeptime> change # mins between displays from default 30
X# -r in the rare case aff says its running and it isn't.
X
Xstime=4 #1800 # default; every half hour
Xonaffile=$HOME/.affon # The files used to keep track of the current aff.
Xoffaffile=$HOME/.affoff # From login to login.
XUSAGE="Usage: aff -q | {[-t <sleeptime>] [-n <affirmation> | -c <affirmation> ]}"
Xexport stime onaffile offaffile
Xtrap "mv $onaffile $offaffile" 2 3 1
X
Xturnoff() {
X mv $onaffile $offaffile
X}
X
Xwhile getopts qrt:n:c: C
Xdo
X case $C in
X t) stime=`expr $OPTARG \* 60` ;;
X n) if test -r $onaffile
X then
X echo "Aff is already running; use -c option." >&2
X exit 1
X fi
X echo "$OPTARG \c" > $offaffile
X ;;
X c) if test ! -r $onaffile
X then
X echo "Sorry, -c option only good while aff is running." >&2
X exit 1
X fi
X shift `expr $OPTIND - 1`
X OPTARG="$OPTARG $*"
X echo "$OPTARG" > $onaffile
X exit 0
X ;;
X r) mv $onaffile $offaffile ;;
X q) turnoff; exit 0;;
X \?) echo "\n\n$USAGE\n\n" >&2; exit 1 ;;
X esac
Xdone
Xshift `expr $OPTIND - 1`
X
Xif test -r $onaffile
Xthen
X turnoff
X tput clear
X exit 0
Xelse
X if test -r $offaffile
X then
X echo "$*" >> $offaffile # in case they didn't use quotes
X mv $offaffile $onaffile
X else
X echo "Affirmation: \c"
X read $AFF
X echo "$AFF" > $onaffile
X fi
Xfi
X
XLASTROW="`tput lines`"
XLASTCOL="`tput cols`"
XAFFROW=`expr $LASTROW / 2`
XBOLDIT="`tput smso`"
XNOBOLD="`tput rmso`"
XCINV="`tput civis`"
XCSAV="`tput sc`"
XCRET="`tput rc`"
XLEAVE="$CSAV$CINV$BOLDIT"
XRETURN="$NOBOLD$CRET$CVIS"
XAFF=`cat $onaffile`
Xtemp=`cat $onaffile | wc -c `
Xti=`expr 72 - $temp`
Xtti=`expr $ti / 2`
XPOS=`tput cup $AFFROW $tti`
Xexport LEAVE RETURN AFFROW POS
X(
Xwhile test -r $onaffile
Xdo
XAFF=`cat $onaffile`
Xecho "${LEAVE}$POS$AFF$RETURN\c"
Xsleep $stime
Xdone
X) > /dev/tty &
Xecho "starting affirmations every `expr $stime / 60` minute(s)."
Xexit 0
END_OF_FILE
if test 2591 -ne `wc -c <'aff'`; then
echo shar: \"'aff'\" unpacked with wrong size!
fi
# end of 'aff'
fi
echo shar: End of archive.
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.