Friends here is code which is used to add floating point using bc, but I m not getting any output instead some errors.
1 #!/bin/bash
4 if [ -c /proc/$$/fd/0 ]
5 then
6 echo "Our input is from a Device"
7 while read myline
8 do
9
10 total= `echo $total + $myline |bc`
11 #((total=$total+ $myline))
12 done
13
14 elif [ -p /proc/$$/fd/0 ]
15 then
16
17 echo "Our input is from a pipe"
18 while read myline2
19 do
20 total= `echo $total + $myline |bc`
21 #((total= $total+ $myline2))
22 done
23 elif [ -f /proc/$$/fd/0 ]
24 then
25
26 echo "Our input is from a file"
27 while read myline3
28 do
29 add=+
30 $(($total $add $myline))| bc
31 #echo $total $myline
32 #total= echo `$total $add $myline |bc`
33 #((total= $total+ $myline))
34 done
35
36
37
38 echo "Error"
39 break;
40 fi
41
42 echo total is $total