Build a Build Script: Part 13

Regarding Part 13 of: Build a Build Script

  • Copy but replace “42” with “XX”.
    One possible solution uses the sed command with option -i .
    sed -i 's/42/xx'
    The option -i (short for: –in-place) enables us to: directly edit our text within a file.

  • Zip the resulting /build directory.
    For this one I tried:
    zip -r /build
    The command line option -r adds files recursively, it should create a zip file for all the files inside the (sub-)directory /build. However, I’m currently getting an error message!

Further, I don’t know how to do the last two bullet point.
Thank you and look forward to seeing your inputs…

1 Like

I believe your zip attempt will work if you move the option parameter to its proper location immediately following zip: zip -r /build

I’ll try to answer your other questions from this post, and previous posts when I have more time. I’m a little rusty with bash scripting, so I have to remember or re-learn to be of any use :wink:

Hopefully someone else better suited than me can chime in to assist you.

Happy coding!


Thank you, midlindner!

Although we’ve now managed to create our file;
however the progress was printing (stored 0%) and (deflated 10%), which does not look right?
Please see a screenshot below:

I found this:

When zip add a file, it will compress it if it makes sense.

If the file is big enough, zip will use the compression algorithm DEFLATE (and print “deflated” and the % gained with the compression).

For very small files the compression will make the result bigger (for example, if I manually deflate a file with 2 bytes, I will get 4 bytes) so zip decides to STORE them (no compression) : it prints “stored” and 0% because this “compression” didn’t change the size. zip will also STORE folders (no content).

You can easily play with the compression : zip -0 will STORE everything, zip -1 to zip -9 will change the compression level of DEFLATE and zip -Z bzip2 will change the compression method.

So, to answer to your question : the stored 0% is fine ! The file has been added but not compressed.


Most of those files are empty, so they don’t get compressed. To see if zip worked properly, you can hover over the “build” folder, click on the 3 dots, and delete the folder. Then in the bash console type:
$ unzip This will unzip the zipped file into a new “build” folder. Compare the files to the files in your “source” folder, and you’ll see they are the same.


Thank you very much!
I just followed your delete/unzip idea, and it worked great!


I have a problem concerning the zip command too:
Everything seems perfectly fine but after I run the zip command it always says " bash: zip: command not found"
Can somebody tell me why this always happens?
Help would be appreciated.


I have the same problem with zip and git commands in this exercise. They are not found in terminal as if they are not in $PATH folders.

My guess is that they aren’t actually installed in the command line of Codecademy’s webpage…