Исправленный оригинал
#!bin/sh
a=0
while [ "$a" -lt "50" ] # mind the spaces and double quote the variable
do
echo "$a"
a=`expr $a + 1` # replace single quotes with backticks, mind the space between $a and 1
done
Улучшения
#!bin/bash # Why not put bash here? sh may not always be linked to bash
a=0
while [ "$a" -lt "50" ] # mind the spaces and double quote the variable
do
echo "$a"
a=$(expr $a + 1) # replace legacy backticks with $()
# Or better you can even use double parenthesis which allows you do
# (( a++ )) , note the C style increment operator here
done
Примечание Для проверки скриптов используйте [shellcheck] .