-
-
Save sneeu/9931143 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
# To add two items to the current .gitignore file: | |
# requirement Django South | |
# | |
# To sort and de-dupe the current .gitignore file: | |
# requirement | |
args=( $@ ) | |
args_len=${#args[@]} | |
requirements_file=${args[args_$len-1]} | |
requirements=${args[@]:0:args_$len-1} | |
# Append each argument to its own line: | |
for item in "$requirements"; do | |
pip freeze | grep "$item" >> $requirements_file; | |
done | |
# Remove duplicates (and sort): | |
sort -u $requirements_file -o $requirements_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment