fork(3) download
  1. #!/bin/bash
  2. html='<html>
  3. <head>
  4. <title>My App</title>
  5. </head>
  6. <body>
  7. <div id="app"></div>
  8. <script>window.API_URL = '"''"'</script>
  9. </body>
  10. </html>'
  11.  
  12. MY_API_URL='https://w...content-available-to-author-only...e.com/api'
  13. sed 's/\(window\.API_URL =\)[^<]*/\1 "'"${MY_API_URL//\//\\\/}"'";/' <<< "$html"
Success #stdin #stdout 0s 4936KB
stdin
Standard input is empty
stdout
<html>
<head>
<title>My App</title>
</head>
<body>
<div id="app"></div>
<script>window.API_URL = "https://w...content-available-to-author-only...e.com/api";</script>
</body>
</html>