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.

Bash Percentage Calculator For Linux

Go down

Bash Percentage Calculator For Linux Empty Bash Percentage Calculator For Linux

Post by jamied_uk 26th January 2016, 21:40

Code:
#!/bin/bash
# (c) J~Net 2016 Bash Percentage Calc
# this will calc percentage % Forum http://jnet.forumotion.com/t1034-bash-percentage-calculator-for-linux#1364
# Usage: bash perc.sh
echo -e "Enter A Number \c"      # get user input
read INPUT
num1=$INPUT
echo -e "Enter The Desired Percentage \c"      # get user input
read INPUT2
num2=$INPUT2
echo -e $((INPUT / 100 * INPUT2))


Version 2

Code:
#!/bin/bash
# (c) J~Net 2016 Bash Percentage Calc
# this will calc percentage %
# Usage: bash perc.sh
echo -e "Enter A Number \c"      # get user input
read INPUT
echo -e "Enter The Desired Percentage \c"      # get user input
read INPUT2
tot=$((INPUT / 100 * INPUT2))
echo -e "Your Number "$INPUT
echo -e "Percentage "$INPUT2
echo -e "Answer "$tot


Last edited by jamied_uk on 26th January 2016, 22:40; edited 3 times in total
jamied_uk
jamied_uk
Admin

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

https://jnet.sytes.net

Back to top Go down

Bash Percentage Calculator For Linux Empty Re: Bash Percentage Calculator For Linux

Post by jamied_uk 26th January 2016, 21:58

jamied_uk
jamied_uk
Admin

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

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

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