I have a bash script that I want to run in cluster. But I run into following errors:
/var/spool/slurmd/job24250582/slurm_script: line 5: i_hard: command not found
/var/spool/slurmd/job24250582/slurm_script: line 6: i_soft: command not found
/var/spool/slurmd/job24250582/slurm_script: line 7: i_neutral: command not found
What I want to do is read all the files in the directory. And then depending upon whether that file has word 'hard','soft',or 'neutral', I want to run specific commands on the cluster.
#!/bin/bash
#generating training data
i_hard = 0
i_soft = 0
i_neutral = 0
for entry in /Users/documents/popGen/sample/slim_script/*
do
if [[ $entry == *"hard"* ]]; then
echo "It's there!"
/home/popGen/build/./slim $entry > /home/popGen/sweeps/msOut/hard_$i.msOut.gz
i_hard = $((i_hard+1))
fi
if [[ $entry == *"soft"* ]]; then
echo "It's there!"
/home/popGen/build/./slim $entry > /home/popGen/sweeps/msOut/soft_$i.msOut.gz
i_soft = $((i_soft+1))
fi
if [[ $entry == *"neutral"* ]]; then
echo "It's there!"
/home/popGen/build/./slim $entry > /home/popGen/sweeps/msOut/neutral_$i.msOut.gz
i_neutral= $((i_neutral+1))
fi
done
This code should generate files but I get the error mentioned above. Can someone explain why I am getting this error?