Bash Cheatsheet
I’ve gotten tired of googling the same things over and over again. While loops Run for period of time #!/bin/bash runtime="5 minute" endtime=$(date -ud "$runtime" +%s) while [[ $(date -u +%s) -le $endtime ]] do echo "Time Now: `date +%H:%M:%S`" echo "Sleeping for 10 seconds" sleep 10 done Resource: https://www.golinuxcloud.com/run-while-loop-until-specific-time-shell-bash/ Infinite loop item=true while [ $item = true ]; do echo 'bla'; done While value is an empty string value="" while [[ -z "$value" ]]; do echo "value is empty" # here's where we break out if [[ "$value" ]]; then echo "exiting loop because value has been set to $value" break fi done Read each line of a file while read p; do echo "$p" done <file....