Last active
June 7, 2018 07:18
-
-
Save msudgh/bbbc204c0f3a816536926ec19a392e5e to your computer and use it in GitHub Desktop.
Compress the files and exclude the gitignore file lines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -------------------------------------------------------------- | |
# [Author] Masoud Ghorbani (@msudgh) | |
# [Created] June 8, 2017 | |
# [Description] Compress the files and exclude the gitignore file lines | |
# -------------------------------------------------------------- | |
# Define the source file that represent the files to be exclude | |
file=.gitignore | |
# Define zip package's name | |
filename=/${PWD##/} | |
# Extract gitignore file's line to exclude from ls command | |
excludedList=$(while IFS= read -r line; do echo "-I $line"; done < $file) | |
includeList=$(ls $excludedList -I ${0##*/}) | |
# Zip the ls list | |
zip -q -r /$filename $includeList | |
echo "It's Done, ❤ Good Luck." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment