How do you raise m to the power of n? I've searched for this everywhere. What I found was that writing m**n
should work, but it doesn't. I'm using #!/bin/sh
.
To execute a Power Bash, simply hold the action button instead of clicking it once, just like performing a Power Attack with any melee weapon. The Power Bash staggers enemies for a noticeably longer period of time than the regular bash does, in addition to doing more damage.
$() – the command substitution. ${} – the parameter substitution/variable expansion.
$? is the exit status of the most recently-executed command; by convention, 0 means success and anything else indicates failure. That line is testing whether the grep command succeeded. The grep manpage states: The exit status is 0 if selected lines are found, and 1 if not found.
The $$ variable is the PID (Process IDentifier) of the currently running shell. This can be useful for creating temporary files, such as /tmp/my-script. $$ which is useful if many instances of the script could be run at the same time, and they all need their own temporary files.
I would try the calculator bc. See http://www.basicallytech.com/blog/index.php?/archives/23-command-line-calculations-using-bc.html for more details and examples.
eg.
$ echo '6^6' | bc
Gives 6 to the power 6.
Using $n**$m really works indeed. Maybe you don't use the correct syntax to evaluate a math expression. Here's how I get the result on Bash:
echo $(($n**$m))
or
echo $[$n**$m]
The square brackets here are not meant to be like the test evaluator in the if statement so you can you use them without spaces too. I personally prefer the former syntax with round brackets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With