Skip to content

Instantly share code, notes, and snippets.

@stes
Last active March 27, 2021 01:19
Show Gist options
  • Save stes/2fd256e462dbb8fdb9ac7a947ba86217 to your computer and use it in GitHub Desktop.
Save stes/2fd256e462dbb8fdb9ac7a947ba86217 to your computer and use it in GitHub Desktop.
Download .gitignore templates from https://github.com/github/gitignore
#!/bin/bash
# Download gitignore files from https://github.com/github/gitignore
# Example Usage: ./gitignore.sh Python Java > .gitignore
invalid_language() {
>&2 echo "No gitignore found for $1."
return 1
}
echo_header() {
echo "## gitignore for ${1}"
echo "## Source: ${2}"
}
for language in $@; do
url="https://raw.githubusercontent.com/github/gitignore/master/${language}.gitignore"
wget -q --spider "$url" || invalid_language "${language}" || continue
echo_header "$language" "$url"
wget -q -O- "$url"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment