Skip to content

Instantly share code, notes, and snippets.

@JonasGroeger
Created August 5, 2016 07:38
Show Gist options
  • Select an option

  • Save JonasGroeger/3ebaeb9481211eaef2238296c006ea9e to your computer and use it in GitHub Desktop.

Select an option

Save JonasGroeger/3ebaeb9481211eaef2238296c006ea9e to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# This script copies the contents of the block below into a file.
# Useful for self-extracting configuration files or the like.
#
# Author: Jonas Gröger <[email protected]>
#
<<DATASECTION
Put the contents of the file here
DATASECTION
ME="$(realpath $0)"
TARGET_FILE="somefile"
sed '/<<DATASECTION/,/DATASECTION/!d;//d' "$ME" > "$TARGET_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment