Runs

A working dogscript

So the superscript that runs the dogscript is:
supersetup.sh, and its output goes to the file supersetup.log. It requires the file at the bottom of this post (setup5.sh) to be executable and in your bin directory.

Code
#!/bin/bash
setup5.sh | tee setup5.out
grep “You spent” setup5.out > supersetup.log
#

Output file:
Its output (supersetup.log), tested this morning, is:

You spent 79 minutes to train 10 comes with Spin and 10 stays with both dogs at dog park.
You spent 36 minutes to Fix bike, clean bathroom.
You spent 69 minutes to work on backup program. learn about RAM. Find out where compilers are, and how to compile in c. read paper on computation and evolution.

Run again this afternoon:
You spent 195 minutes to work on code, read papers, find c program.
You spent 80 minutes to 4 mile bike ride with dogs for groceries.

The working code itself is here:setup5.sh

#!/bin/bash
#
#
#
#
#
#
event_array=(“nothing” “walking dogs” “work” “workout” “clean up” “pay bills” “backup system”)
num_events=7
date
echo “Today is a brand new day. How would you like to start?”
echo ” ”
echo ” ”
echo ” ”
echo “Please enter numbers in the order you would like to proceed separated”
echo “by spaces. Simply enter 0 to ignore.”
echo ” ”
echo ” ”
echo ” ”
i=1
while [ $i -lt 7 ]
do
echo “$i. ${event_array[$i]}.”
i=$(( $i + 1 ))
done
echo ” ”
echo ” ”
echo “Choices?”
read choice
echo ” ”
echo “You chose to proceed in the following order: $choice”
echo ” ”
echo ” ”
for i in ${choice}
do
echo “${event_array[$i]}”
done
count=””
for i in ${choice}
do
finished=””
eventbgn=””
echo ” ”
echo ” ”
echo “${event_array[$i]]} anticipated.”
echo “Describe your activity. ”
read description
echo “Please press enter when you begin your activity.”
read bgn
date
# eventbgn=”$(expr $(”date | awk ‘{print $4}”’|sed “s/:.*//”)*60+
# expr $(”date | awk ‘{print $4}”’|sed “s/^..:\(..\).*/\1/”))”
eventbgn=”$(expr $(”date | awk ‘{print $4}”’|sed “s/:.*//”)*60+
expr $(”date | awk ‘{print $4}”’|sed “s/^..:\(..\).*/\1/”))”
# echo $eventbgn
echo “Please press enter when you have finished to ${event_array[$i]]}.”
read finished
while [ -n “$finished” ];
do
break
done
date

eventend=”$(expr $(”date | awk ‘{print $4}”’|sed “s/:.*//”)*60+
expr $(”date | awk ‘{print $4}”’|sed “s/^..:\(..\).*/\1/”))”
echo
echo “You spent $(($((eventend))-$((eventbgn)))) minutes to $description ”
echo “thereby accomplishing your ${event_array[$i]]} activity.”
count=$(expr $((count+1)))
echo -n $count “. ”
case “$i” in
0)
echo “It’s ok. We all have bad days.”
;;
1)
echo “Dog Walk done. Your dogs say: “I love you””.
;;
2)
echo “Work done. Relax.”
;;
3)
echo “Work out done. Your body says thank you for caring!”
;;
4)
echo “Clean up done. Good job!!!!!”
;;
5)
echo “Pay bills done. Ouch!”
;;
6)
echo “Backup system done. Find a blank CD.”
;;
esac
done
#
#

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s