1

Directory structure:

/home
---ubuntu
------projects
---------project1
---------project2
---------project3
------.ignore

.ignore:

*project1* *project2*

If I run:

zip -r zipush.zip projects -x "$(< .ignore)"

Then it creates a zip containting all three projects - which is a wrong result. I want it to ignore project1 and project2.

However, it does work well when I write the arguments explicitly:

zip -r zipush.zip projects -x *project1* *project2*

But I don't understand why, because "$(< .ignore)" seems to work well when I type for example:

echo "$(< .ignore)"

Output:

 *project1* *project2*
2

First, change your .ignore file to this:

project1/*
project2/*

Second, change your -x switch to -x@.ignore.

|improve this answer|||||
  • Still not working. It's zipping all projects. I ran: zip -r zipush.zip projects -x@.ignore – Alon Aug 7 '19 at 19:06
  • I think it's the location of the .ignore file. Try -x@projects/.ignore or move it to /home/ubuntu. – ajgringo619 Aug 7 '19 at 19:09
  • OK I've solved that. I changed it to project1 and project2 (in different lines and it's working now. – Alon Aug 7 '19 at 19:09
  • with astersisks, SO for some reason uses asterisks in comment to make the font italic – Alon Aug 7 '19 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.