Bash Calculator Issue
Posted: 2009-07-21T16:31:57-07:00
I am using the bc command in my script but I cannot figure out how to integrate it into the filter. I have taken out the bc and the filter output is the same as it is with the bc command. I could really use some help here. I appreciate your time.
This is from the terminal. I want this math to integrate with the filter output of the image. Basically the image goes lighter to darker over time, I want it to get darker at a slower rate. I know 1/2 wont do that but this is just an example.
Code: Select all
count=$START
SETSTEPS=$(echo "scale=2; 1/2" | bc)
SETTING=$SETSTEPS
while [ $count -le $END ];
do
echo $count
#set for padding of 4 from 0-999.
if [ $count -lt 10 ]; then
convert ${IMGDIR}${IMG} -charcoal $count ${OUTDIR}${OUT}.000$count.jpg
fi
if [ $count -ge 10 ] && [ $count -le 99 ]; then
convert ${IMGDIR}${IMG} -charcoal $count ${OUTDIR}${OUT}.00$count.jpg
fi
if [ $count -ge 100 ] ; then
convert ${IMGDIR}${IMG} -charcoal $count ${OUTDIR}${OUT}.0$count.jpg
fi
SETTING=$(echo "scale=2; $SETTING+$SETSTEPS" | bc)
echo "processing frame: "$count " setting is: " $SETTING "setsteps is " $SETSTEPS""
let count=count+1
processing frame: 0 setting is: 1.00 setsteps is .50
1
processing frame: 1 setting is: 1.50 setsteps is .50
2
processing frame: 2 setting is: 2.00 setsteps is .50
3
processing frame: 3 setting is: 2.50 setsteps is .50
4
processing frame: 4 setting is: 3.00 setsteps is .50
5
processing frame: 5 setting is: 3.50 setsteps is .50
6
processing frame: 6 setting is: 4.00 setsteps is .50
7
processing frame: 7 setting is: 4.50 setsteps is .50
8
processing frame: 8 setting is: 5.00 setsteps is .50
9
processing frame: 9 setting is: 5.50 setsteps is .50
10
processing frame: 10 setting is: 6.00 setsteps is .50