I need help please bc calculator

amel

New Member
Joined
Dec 5, 2021
Messages
1
Reaction score
0
Credits
11
Hello!!
I have a problem so please help me. I want to use bc calculator with redirections and i want the result on the screen and then in a file. how can i do this??
Thank you
 


JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,491
Reaction score
2,115
Credits
10,630
The link posted by @Lord Boltar should get you started with bc.

And to get the last part - the result displayed on screen AND redirected to a file - simply pipe the output from bc to the tee command and specify the name of the file to write to.

e.g.
Bash:
echo "5+7" | bc -l | tee /path/to/outputfile
That will echo the result of the calculation to the screen and to a file.
 

Ngwabe Andrew

New Member
Joined
Jan 2, 2021
Messages
2
Reaction score
0
Credits
11
And to get the last part - the result displayed on screen AND redirected to a file - simply pipe the output from bc to the tee command and specify the name of the file
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Latest posts

Top