PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Linux Bash Maths Raise To The Power Example

Go down

Linux Bash Maths Raise To The Power Example Empty Linux Bash Maths Raise To The Power Example

Post by jamied_uk 20th July 2016, 12:04





Code:
#!/bin/bash
# Usage: ./Power.sh 19
#
var=("$@") # User Input
echo "$var"^6 | bc # Customize to whatever Power you want, default here is 6
jamied_uk
jamied_uk
Admin

Posts : 2943
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Linux Bash Maths Raise To The Power Example Empty Re: Linux Bash Maths Raise To The Power Example

Post by jamied_uk 20th July 2016, 12:15

To use a range without the need for loops



Code:
#!/bin/bash
# Usage: ./range.sh
#
echo {1..99}
jamied_uk
jamied_uk
Admin

Posts : 2943
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum