Linux Bash Maths Raise To The Power Example

View previous topic View next topic Go down

Linux Bash Maths Raise To The Power Example

Post by jamied_uk on 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
avatar
jamied_uk
Admin

Posts : 2184
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Linux Bash Maths Raise To The Power Example

Post by jamied_uk on 20th July 2016, 12:15

To use a range without the need for loops



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

Posts : 2184
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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