Skip to content

Instantly share code, notes, and snippets.

@mostlygeek
Created April 11, 2013 16:39
Show Gist options
  • Save mostlygeek/5364992 to your computer and use it in GitHub Desktop.
Save mostlygeek/5364992 to your computer and use it in GitHub Desktop.
what does quoting do w/ a bash heredoc?
#!/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
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