In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "Linux common command bc how to use", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "Linux common command bc how to use" this article.
Linux common command bc command is an arbitrary precision calculator language, usually used as a calculator under linux, it is similar to the basic calculator, using this calculator can do basic mathematical operations
Common operations:
+ addition
-subtraction
* multiplication
/ division
^ index
% remainder
Syntax bc (option) (parameter) option value
-I: force to enter interactive mode
-l: defines the standard math library used
;-w: give a warning about the extension of POSIX bc
-Q: do not print normal GNU bc environment information
-v: displays instruction version information
-h: displays the help information for the instruction.
Parameters.
File: specifies the file that contains the calculation task.
Example $bc bc 1.06.95 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 2'3 5 5-2 3 2 3 3 1 5 enter quit to exit.
Through the pipe symbol
$echo "15 places 5" | set bc 20scale=2 to decimal places, and 2 means to retain two places:
$echo 'scale=2; (2.777-1.4744) / 1' | bc 1.30bc not only sets decimal places by scale, but also uses ibase and obase for other base operations:
$echo "ibase=2;111" | bc 7-ary conversion
#! / bin/bash abc=192 echo "obase=2;$abc" | the result of bc execution is 11000000, which converts decimal to binary with bc. #! / bin/bash abc=11000000 echo "obase=10;ibase=2;$abc" | the result of bc execution is 192, which converts binary to decimal with bc. The above is all the contents of the article "how to use Linux commands bc". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.