Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    STRING=$( cat <<EOF Linelineline ) -- What is this?

    The full command is here:
    STRING=$( cat <<EOF
    Great. You've now set up local and remote postgres databases for your
    app to talk to.\n\n
    Now do the following:\n\n
    1) Get your API key from\n\n
    2) Paste it into the .env file.\n\n
    3) To run the server locally, do:\n
         $ foreman start\n
       Then check your EC2 URL, e.g. \n
       Try placing some orders and then clicking '/orders' at the top.\n\n
    4) To deploy to heroku\n
         $ git push heroku master\n
         $ heroku config:push\n
       Then check the corresponding Heroku URL\n\n
       Try placing some orders and then clicking '/orders' at the top.\n
    echo -e $STRING
    EOF stands for end of file. I know round brackets means array but I hesitate here. Dollar sign indicates parameter expansion. Cat prints out what is after it and the << is redirecting stdout to cat I guess. I do not know why EOF is right there though.

    Could someone explain what is happening and if there is a formal name for it?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    variable=$(command) is used for command substitution.
    The command is called in a subshell and variable will contain the output of command.

    This construct is called a Here document:
    cat <<EOF

    See here:
    Command Substitution
    Here Documents
    You must always face the curtain with a bow.

  3. #3

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts