This is a text-only version of the following page on https://raymii.org: --- Title : NurseCalc o2 - Bash script and online app for Oxygen Calculations Author : Remy van Elst Date : 12-02-2012 URL : https://raymii.org/s/software/Nursecalc-o2.html Format : Markdown/HTML --- This script will help you with nursing-related oxygen calculations. **Also available as an online tool, scroll down for the link**.

Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:

I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!

Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.

You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $200 credit for 60 days. Spend $25 after your credit expires and I'll get $25!

Usage: ./o2.sh $si $pr $to $do Three variables are needed, the other will be calculated. Unknown variable should be entered as 0 $si = Size of the o2 tank in liters (eg 2, 5, 10) $pr = Pressure in o2 tank in atm (eg 120, 65, 90) $to = Total time o2 needs to run in minutes (eg 720, 300, 1500) $do = Dosage of o2 in ltr per minute (eg 2, 4, 10) example: ./o2.sh 2 85 2 0 will output 85 minutes. example: ./o2.sh 40 90 720 0 will output 5 liters per minute THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ##### Online version Thanks to the [Illumination Software Creator application builder][2] I've made an online version. Same license, has bugs, not ready for production, regular blabla.. Use on your own risk. [NurseCalc o2 Online][3] ##### Bash Script ##### o2.sh #!/bin/bash # o2.sh by raymii.org # script displays errors with float numbers, but calc is correct. #Copyright (c) 2012 Remy van Elst #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #copies of the Software, and to permit persons to whom the Software is #furnished to do so, subject to the following conditions: # #The above copyright notice and this permission notice shall be included in #all copies or substantial portions of the Software. # #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN #THE SOFTWARE. SI=$1 PR=$2 SP=$3 DO=$4 function expl { echo 'NurseCalc o2 by Raymii.org. READ LICENSE'; echo 'Usage: ./o2.sh $si $pr $to $do '; echo 'Three variables are needed, the other will be calculated. Unknown variable should be entered as 0' echo '$si = Size of the o2 tank in liters (eg 2, 5, 10)'; echo '$pr = Pressure in o2 tank in atm (eg 120, 65, 90)'; echo '$to = Total time o2 needs to run in minutes (eg 720, 300, 1500)'; echo '$do = Dosage of o2 in ltr per minute (eg 2, 4, 10)'; echo 'Decimal hours to minutes: 4.87 hours = 0.87 hours * 0.60 = 4 hours and 52 minutes'; echo 'example: ./o2.sh 2 85 2 0 will output 85 minutes.'; echo 'example: ./o2.sh 40 90 720 0 will output 5 liters per minute'; echo 'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.'; } if [ -e $1 ] || [ -e $2 ] || [ -e $3 ] || [ -e $4 ]; then echo 'ERROR: One or more of the required input variables was/were empty.'; expl; exit 1 elif ! [[ "$SI" =~ ^[0-9]+([.][0-9]+)?$ ]] || ! [[ "$PR" =~ ^[0-9]+([.][0-9]+)?$ ]] || ! [[ "$SP" =~ ^[0-9]+([.][0-9]+)?$ ]] || ! [[ "$DO" =~ ^[0-9]+([.][0-9]+)?$ ]]; then exec >&&2; echo 'ERROR: One or more of the variables are not numerical (integer or float)'; expl; exit 1 elif [ $SI -eq 0 ]; then # size wanted exec >&&2; echo 'NurseCalc o2 by Raymii.org. READ LICENSE'; echo -e "Pressure $2 atm, nTotal time $3 min nDosage $4 ltr/min "; echo "########## ANSWER ##########" echo "Size of the tank in liters:"; echo "scale=2; $SP / $PR * $DO" | bc exit 0 elif [ $PR -eq 0 ]; then # pressure wanted exec >&&2; echo 'NurseCalc o2 by Raymii.org. READ LICENSE'; echo -e "Size of the tank $1 ltr, nTotal time $3 min nDosage $4 ltr/min "; echo "########## ANSWER ##########" echo "Pressure of the tank in atm:"; echo "scale=2; $SP * $DO / $SI" | bc exit 0 elif [ $SP -eq 0 ]; then # total time wanted exec >&&2; echo 'NurseCalc o2 by Raymii.org. READ LICENSE'; echo -e "Size of the tank $1 ltr, nPressure $2 atm nDosage $4 ltr/min "; echo "########## ANSWER ##########" echo "Total time of dosage in minutes:"; echo "scale=2; $SI * $PR / $DO" | bc echo 'Total time in hours:'; echo "scale=0; ( $SI * $PR / $DO ) / 60" | bc exit 0 elif [ $DO -eq 0 ]; then # dosage wanted exec >&&2; echo 'NurseCalc o2 by Raymii.org. READ LICENSE'; echo -e "Size of the tank $1 ltr, nPressure of the tank $2 atm nTotal time $3 min"; echo "########## ANSWER ##########" echo "Dosage in ltr/min"; echo "scale=2; ( $SI * $PR ) / $SP" | bc exit 0 fi ##### Example output remy@solaris2 ~/projects/scripts/bash/vpcalc $ bash ./o2.sh 0 90 720 5 NurseCalc o2 by Raymii.org. READ LICENSE Pressure 90 atm, Total time 720 min Dosage 5 ltr/min ########## ANSWER ########## Size of the tank in liters: 40.00 [1]: https://www.digitalocean.com/?refcode=7435ae6b8212 [2]: http://radicalbreeze.com [3]: /s/inc/software/o2/index.html --- License: All the text on this website is free as in freedom unless stated otherwise. This means you can use it in any way you want, you can copy it, change it the way you like and republish it, as long as you release the (modified) content under the same license to give others the same freedoms you've got and place my name and a link to this site with the article as source. This site uses Google Analytics for statistics and Google Adwords for advertisements. You are tracked and Google knows everything about you. Use an adblocker like ublock-origin if you don't want it. All the code on this website is licensed under the GNU GPL v3 license unless already licensed under a license which does not allows this form of licensing or if another license is stated on that page / in that software: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Just to be clear, the information on this website is for meant for educational purposes and you use it at your own risk. I do not take responsibility if you screw something up. Use common sense, do not 'rm -rf /' as root for example. If you have any questions then do not hesitate to contact me. See https://raymii.org/s/static/About.html for details.