I'm new to bash and try a simple loop but the value of my variable is being lost after it and I can not understand why - I have looked at few similar issues but they are all related to subshell execution of a while loop . I'm not doing but still facing issues - can someone explain me where is my mistake ?
#!/bin/bash
check_ss ()
{
command_list | awk '{print $1 $9}' > ss.out
for i in {1..8}
do grep -Pa "\x3$i" ss.out > ss$i.out
if grep -w "NotStarted" ss$i.out
then
ss$i=0
else
ss$i=1
fi
done
}
check_ss
echo $ss1
echo $ss2
echo $ss3
echo $ss4
I'm getting this on execution :
[root@lubo ~]# ./ss.sh
./ss.sh: line 21: ss1=1: command not found
./ss.sh: line 21: ss2=1: command not found
./ss.sh: line 21: ss3=1: command not found
./ss.sh: line 21: ss4=1: command not found
./ss.sh: line 21: ss5=1: command not found
./ss.sh: line 21: ss6=1: command not found
./ss.sh: line 21: ss7=1: command not found
./ss.sh: line 21: ss8=1: command not found
Thanks in advance