Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash math expression

# Basic syntax:
$((your_expression))

# Example usage:
echo $(((5 * 4)/3))
--> 6 
# Note, if you only use integers in your expression, the answer will be
#	rounded down to the nearest integer
echo $(((5 * 4.0)/3))                                                                                                                                                                                                                                             100%  
--> 6.666666666666667
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bash #math #expression
ADD COMMENT
Topic
Name
9+1 =