Created
April 2, 2020 15:43
-
-
Save luistak/e577b0f8a8502a578c769fb5f846c7e3 to your computer and use it in GitHub Desktop.
Shell Script to prepend some content into any file
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 | |
FILE=$1 | |
DATA=$2 | |
cat <<-EOF > $FILE | |
$(echo -e $DATA) | |
$(cat $FILE) | |
EOF | |
# Usage: ./prepend-file.sh awesome_file.txt "I'm prepending this\nMultiline string" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment