Find the answer to your Linux question:
Results 1 to 3 of 3
The full command is here: Code: 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) ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2013
    Posts
    14

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


    The full command is here:
    Code:
    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 coinbase.com/account/integrations\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. ec2-54-213-131-228.us-west-2.compute.amazonaws.com:8080 \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
    EOF
    )
    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
    Location
    Munich
    Posts
    3,376
    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
    whatever
    EOF

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

  3. #3
    Just Joined!
    Join Date
    Jun 2013
    Posts
    14
    Thank you!

Posting Permissions

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