crouse,
I'm totally lost concerning your reply.
You said it would be easier if the output was variables...
A portion of the code:
Code:
# Loading yesterday's balance from text file into variable
# 'st' will represent /home/bob/st--the file that holds
# the previous days balance from the fund.
st=`cat</home/bob/st`
echo -e "Previous balance: \$$st"
echo
echo -n "Today's balance: \$"
read b
b=$(echo "scale=0; "$b"/.01" | bc)
st=$(echo "scale=0; "$st"/.01" | bc)
str=$(echo "scale=2; "$b"*.01" | bc)
if [ $b -gt $st ]
then bi=$(( $b - $st ))
bi=$(echo "scale=2; "$bi"*.01" | bc)
report="Increase of \$$bi"
fi
if [ $b -lt $st ]
then bd=$(( $st - $b ))
bd=$(echo "scale=2; "$bd"*.01" | bc)
report="Decrease of \$$bd"
fi
if [ $b == $st ]
then
report="Nocrease of \$-----"
fi
And where the results get directed to a text file...
Code:
echo "$str" >> /home/bob/st; chmod 775 /home/bob/st
echo -e "`date +%m-%d-%y`" "\$$str" " `date +%l:%M\ %p`" " $report" >> /home/bob/add
cat /home/bob/ncity /home/bob/add > /home/bob/n2
I thought I was using variables. Are you saying that I should use the 'print' command instead of the 'echo' command? Like I said in my original post, I'm new to scripting and I'm learning.
I have a few different bash tutorials that I've downloaded, so in this situation do I read up on formatting text?
Thanks so much.