• Check it out - we have a chatbot! Go ask TuxBot a question in the Ask Tuxbot section!

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,675
Reaction score
2,429
Credits
13,204
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
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Staff online

Members online


Top