Created
April 15, 2022 20:38
-
-
Save vergenzt/c47c8ecb47fab6d34030905bb6c9ffb6 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -euf -o pipefail # https://sipb.mit.edu/doc/safe-shell/ | |
# https://medium.com/@LihauTan/2f87c770ea9c | |
find . -name .gitignore \ | |
-exec awk ' | |
FNR==1 { print "\n## " FILENAME } \ | |
FNR==1 { cmd = "dirname " FILENAME; cmd | getline DIRNAME; close(cmd) } \ | |
/^ *#/ { print $0; next } \ | |
/^[^!]/ { print DIRNAME "/" $0 } \ | |
/^!/ { print "!" DIRNAME "/" substr($0,2) } \ | |
' '{}' '+' \ | |
> .dockerignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment