Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8398815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:08:32+00:00 2026-06-09T21:08:32+00:00

I have this: #!/bin/bash # Open up the document read -d ” html <<-

  • 0

I have this:

#!/bin/bash

# Open up the document
read -d '' html <<- EOF
<!DOCTYPE html>
<html>
  <head>
    <title>...</title>
    <meta name="...">
    <link rel="stylesheet" type="text/css" href="style.css" />
  </head>
  <body>
EOF

#Overwrite the old file with a new one
echo "$html" > index.html

# Convert markdown to HTML
`cat README.md | marked --gfm >> index.html`

# Put the converted markdown into the HTML
read -d '' html <<- EOF
  </body>
</html>
EOF

# Save the file
echo "$html" >> index.html

But what I’d like is a single write instead Basically, in the first EOF i’d have the </html></body> too, and in between the <body> tags I’d have like {{CONTENT}} to be replaced with cat README.md | marked --gfm like:

read -d '' html <<- EOF
    <!DOCTYPE html>
    <html>
      <head>
        <title>...</title>
        <meta name="...">
        <link rel="stylesheet" type="text/css" href="style.css" />
      </head>
      <body>
      {{CONTENT}}
      </body>
    </html>
    EOF

I tried over and over with the sed command, but I think I’m doing something wrong and I read there’s issues when the file contents to search thru have slashes in it. How could I implement the sed command here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:08:33+00:00Added an answer on June 9, 2026 at 9:08 pm

    I think you can do this using a single call to cat, using command substitution to insert the read-me in the middle:

    cat << EOF > index.html
    <!DOCTYPE html>
    <html>
      <head>
        <title>...</title>
        <meta name="...">
        <link rel="stylesheet" type="text/css" href="style.css" />
      </head>
      <body>
      $(marked --gfm < README.md)
      </body>
    </html>
    EOF
    

    Another option might be to use printf, replacing the {{CONTENT}} placeholder with a simple format string.

    read -d '' -r template <<EOF
    <!DOCTYPE html>
    <html>
    <head>
    <title>...</title>
    <meta name="...">
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
    %s
    </body>
    </html>
    EOF
    
    printf "$template" "$(marked --gfm < README.md)"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this bash script here #!/bin/bash find /Users/ -name *.mov -o -name *.flv
I have this code: #!/bin/bash input=./user.cvs while IFS=';' read -r f1 f2 f3 f4
I have this simple script: #!/bin/bash cmd=file.txt while read line do command $line >
On my Centos 6.2 I have this bash script: [le_me]$ cat get.nb #! /bin/bash
For testing purposes I have this shell script #!/bin/bash echo $$ find / >/dev/null
I have a script that looks like this #!/bin/bash function something() { echo hello
I have a bash script that looks like this: #!/bin/sh previousRelease=`git describe --tags --match
I have a Jekyll blog, I am trying to switch from this {:lang='bash'} #!/bin/sh
I have run this Perl code: #!/usr/bin/perl print content-type: text/html \n\n; print Hello World.\n;
I have this bash code: #!/bin/bash ################################################### # Variables # BACKIFS=$IFS IFS=$'\n' db_file=$PWD/test path_db=$PWD

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.