Build a Build Script Help

I’m stuck on step 9 of this project in the Web Development Path: https://www.codecademy.com/paths/web-development/tracks/learn-the-command-line/modules/bash-scripting/projects/bash-scripting-p

I’ve watched the get help video and my code looks identical to the video’s, but I keep printing the source/secretinfo.md file to build.

This is my code:

#!/bin/bash
echo "Hello"

firstline=$(head -n 1 source/changelog.md)
echo $firstline

read -a splitfirstline <<< $firstline 

version=${splitfirstline[1]}

echo "You are building version" $version

echo 'Do you want to continue? (enter "1" for yes, "0" for no)'

read versioncontinue

if [ $versioncontinue -eq 1 ]
then
  echo "OK"

  for filename in source/*
  do
   echo $filename

  if [ $filename == “source/secretinfo.md” ]
  then
   echo "Not copying" $filename
  else
   echo "Copying" $filename
   cp $filename build
  fi
  done

 else
 echo "Please come back when you are ready."
 fi 

And this is the output:

Copying source/bar.js
....
Copying source/secretinfo.md

Hi ruby9951660504,

I think the issue is in your if statement, bash does not recognise this kind of that you used there (look at the syntax highlighting in the editor in the course: it would be yellow if it was recognised as a string). Try replacing them with the " that you have used in the rest of your script, and I think this would resolve your issue.

All the best,

Thank you so much, that fixed it! :grinning:

1 Like