Build the script Part 10

Hi,

Im on step 10 Bash scripting Build the Script and my files arent copying over from src to build. It’s not going to the else block? Here’s the code:

#!/bin/bash
echo "Welcome"
firstline=$(head -n 1 source/changelog.md)
read -a splitfl <<< $firstline
version=${splitfl[1]}
echo "Your current version is $version"
echo "Enter 1 to continue and 0 to exit"
read versiondec
if [ $versiondec -eq 1 ]
then
  echo "Ok"
  for srcfiles in source/*
  do
    echo $srcfiles
  done
    if [ "$srcfiles" == "source/secretinfo.md" ]
    then
      echo "not copying" $srcfiles
    else
      echo "copying" $srcfiles
      cp $srcfiles build/.
    fi
else
  echo "exit"
fi

Granted, my code is currently mysteriously broken, but shouldn’t the if-then loop that copies/doesn’t copy be in the “do” within the for loop, not after the “done?” I think your code has the “not copying” simply because secretinfo is the last filename to be assigned to $filename

My code runs now, so I have “control” code, and indeed, I’d move the if/then set into the “do” portion if you’re still at work!