Created
April 11, 2013 16:39
-
-
Save mostlygeek/5364992 to your computer and use it in GitHub Desktop.
what does quoting do w/ a bash heredoc?
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
#!/bin/sh | |
greeting="What's up" | |
# notice `EOF` is not quoted | |
cat << EOF | |
No quotes mean I do var substitution: | |
$greeting | |
EOF | |
cat << "EOF" | |
------ | |
"EOF" means no var subtitution | |
$greeting | |
EOF | |
cat << 'EOF' | |
------ | |
'EOF' means no var subtitution | |
$greeting | |
EOF |
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
No quotes mean I do var substitution: | |
What's up | |
------ | |
"EOF" means no var subtitution | |
$greeting | |
------ | |
'EOF' means no var subtitution | |
$greeting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment