I have a bash script in which I want to run a a bunch of files of different times. Instead of creating a lot of if statements or creating a lot of bash scripts I was thinking if there's a way to accept which files to run in bash via command line.
#!/bin/bash
#generating training data
i_hard=0
i_soft=0
i_neutral=0
for entry in /home/noor/popGen/sweeps/slim_script/final/*
do
if [[ $entry == *"hard_FIXED"* ]]; then
echo "It's there!"
/home/stuff/build/./test $entry > /home/noor/popGen/sweeps/msOut/final/hard_$i_hard.txt
i_hard=$((i_hard+1))
fi
if [[ $entry == *"soft_FIXED"* ]]; then
echo "It's there!"
/home/stuff/build/./test $entry > /home/noor/popGen/sweeps/msOut/final/soft_$i_soft.txt
i_soft=$((i_soft+1))
fi
if [[ $entry == *"neutral"* ]]; then
echo "It's there!"
/home/stuff/build/./test $entry > /home/noor/popGen/sweeps/msOut/final/neutral_$i_neutral.txt
i_neutral=$((i_neutral+1))
fi
done
What I want to do is:
#!/bin/bash
i=0
for entry in /home/final/*
do
if [[ $entry == *parameter* ]]; then
echo "It's there!"
/home/stuff/build/./slim $entry > /home/final/parameter_$i.txt
i=$((i+1))
fi
done
So I want 'parameter' is what I want to give through command line which can be hard_FIXED, hard_0, and so on. How can I achieve that?