Complex if then else

for i in $(condition ONE);do for e in $(CONDITION TWO);do

         if [ $i = switch_ports_online1.txt ]; then
                command 1
                command 2
                command 3
         else  if [ $i = switch_ports_online2.txt ]; then
                command 1
                command 2
                command 3
         else  if [ $i = switch_ports_online3.txt ]; then
                command 1
                command 2
                command 3s
         else  if [ $i = switch_ports_online4.txt ]; then
                command 1
                command 2
                command 3
         echo ""
         fi
done;done
cat miofilesss

Hi all
There is a way to not specify every time "switch_ports_online*"?

In this file there is different ports.
Thanks
Luca

Why are you not using the case statement?

i would like to have a way to increase the number of files scanned without writing them all

SWO=switch_ports_online
[ $i = ${SWO}1.txt ]
SWO=switch_ports_online
for [ $i = ${SWO}1.txt ]; do
        echo $i $e

done

does not work

...
case "$i" in
    switch_ports_online[1-4].txt)
               command 1
               command 2
               command 3
               ;;
esac
...

Of course that construct does not work. How should it? Try using a correct syntax:

for i in ${SWO}*.txt; do echo $i; done
switch_ports_online1.txt
switch_ports_online2.txt
switch_ports_online3.txt