I was doing some bash scripting and adding some python for float calculations like divide, deductions
When I am executing this, all part is running fine but for some python part it is showing me an error, however, in the latter part, it is showing me correct calculations.
File "<string>", line 1
print 0.05-
^
SyntaxError: invalid syntax
File "<string>", line 1
print /2
^
SyntaxError: invalid syntax
My script is like the following:
tx_fee=0.0001;
panda_txfee=$(python -c "print $check_t_balance-$tx_fee");
panda=$(python -c "print $panda_txfee/2");
What I am doing wrong?
$check_t_balance
set somewhere?)check_t_balance=1
and run your code, I get$panda
as0.49995
. I think you're just not setting thecheck_t_balance
variable. Also, Python is a bit heavy weight just for doing floating point arithmetics in the shell. Either use something less heavy, such asbc
, or do it all in one single Python program.