im new to bash and im trying to figure out the simplest way to create a while loop that changes the variable number, and checks for a value. this way i can simply add to the variables and the if function knows to keep looping to the end
var='start loop'
var1='something'
var2='something else'
var3='maybe nothing but probably something'
function run() {
while [ ! -z "$var" == true ]
do
x=1
var=var$x
if ! command -v $var &> /dev/null
then
DO SOMETHING
fi
}
x=x+1
done
while [ ! -z "$var" == true ]?? Surely this gives errors.