I have a question regarding how a variable can be called with another variable name inside a loop.
The following script does not work:
#!/bin/bash
# Comparing test1.txt with test2.txt, test1.ini with test2.ini, test1.conf with test2.conf
FIRSTFILE1=test1.txt;
SECONDFILE1=test2.txt;
FIRSTFILE2=test1.ini;
SECONDFILE2=test2.ini;
FIRSTFILE3=test1.conf;
SECONDFILE3=test2.conf;
for NUM in {1..3};
do
diff --brief <(sort $FIRSTFILE$NUM) <(sort $SECONDFILE$NUM) > /dev/null
value=$?
if [ $value -eq 1 ]
then
echo "different"
else
echo "identical"
fi
done