Questions
- Which of the following methods would you used to perform integer math from the command-line?
-
echo 1+1
echo 1 + 1
echo $(bc 1+1)
expr 1+1
expr 1 + 1
-
- You want to ensure that your shell script works on
bash
, as well as on non-bash
shells. Which of the following commands could you use in your script?echo $((1+2+3+4))
echo $[1+2+3+4]
echo $[[1+2+3+4]]
echo $(1+2+3+4)
- You want to perform floating point math. Which of the following commands would you use?
-
bc
bc -f
bc -l
bc --float
-
- You need to find the natural logarithm of 8. How would you do it?
expr log(8)
echo [log(8)]
- Use
l(8)
withbc
- Use
log(8)
withbc
- Which of these commands would you use to find the approximate value of П?
pi=$("scale=10...