Skip to content

Instantly share code, notes, and snippets.

@okwes
Created October 29, 2018 19:14
Show Gist options
  • Save okwes/f24fceffc32142fd81d1c9a65746c6fc to your computer and use it in GitHub Desktop.
Save okwes/f24fceffc32142fd81d1c9a65746c6fc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Hi Mr.p
#--How to run--#
#1. Download then use steps per platform
#Linux: with bash, within working dir ./calculate.sh, make sure to allow exc
#Mac: Should work but minor difrents in corutilities may cause some dif, not sure if 'bc' works on mac so floating point calculations may fail
#Windows: Install linux subsystem then use linux instructions
read -p 'Name output file: ' filename
read -p 'duration of test: ' test
echo "--Start--" >> $filename
for I in {1..100}
do
echo 'type quit to exit, type line to add extra line'
read -p "$I:Imput in ml: " imput
if [ "$imput" = 'quit' ]
then
echo "--END--" >> $filename
echo 'quiting' && break
else
if [ "$imput" = 'line' ]
then
echo " ------extraline" >> $filename
else
calc=$( echo "($imput/$test)*(0.00026)*(60/1)" | bc -l )
echo "Test $I from $imput/$test: $calc gal/min" >> $filename
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment