Creating multiline strings in JavaScript

I have the following code in Ruby. I want to convert this code into JavaScript. What is the equivalent code in JS? text = <<"HERE" This Is A Multiline String HERE

Python subprocess with heredocs

I was playing around with Python's subprocess module, trying a few examples but I can't seem to get heredoc statements to work. Here is the trivial example I was playing with: import subprocess a...

Executing multi-line statements in the one-line command-line?

I'm using Python with -c to execute a one-liner loop, i.e.: $ python -c "for r in range(10): print 'rob'" This works fine. However, if I import a module before the for loop, I get a syntax...

How does "cat << EOF" work in bash?

I needed to write a script to enter multi-line input to a program (psql). After a bit of googling, I found the following syntax works: cat << EOF | psql ---params BEGIN; `pg_dump...

How can I write a heredoc to a file in Bash script?

How can I write a here document to a file in Bash script?

Best way to define a large vba string - i.e. heredoc equivalent?

How should I define large strings in VBA? Is there a better way than coding something like the below? Dim largeString as String largeString = "This is a long block of text that I want to fill " &...

How do you type a tab in a bash here-document?

The definition of a here-document is here: http://en.wikipedia.org/wiki/Here_document How can you type a tab in a here-document? Such as this: cat > prices.txt <<...

Reference — What does this symbol mean in PHP?

What is this? This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this...

What's the difference between these two Perl snippets?

print <<EOF stuff EOF ; print <<EOF; stuff EOF Why would you use one over the other?

Using Perl here-document results in "Can't find string terminator "EOF" anywhere before EOF"

I've been trying to use Here-documents, but it's not working. What might be wrong? Am I missing something obvious? This is the entire contents of the file I'm trying to run (there are no spaces,...

Bash - writing function definition in script after first call (as a GOTO/jump problematics)

I basically want to write me a bash script, where I'd generate a couple of big files using heredoc; and then run some commands using those files. It is understood that (obviously) the heredoc...

Breaking up long strings on multiple lines in Ruby without stripping newlines

We recently decided at my job to a ruby style guide. One of the edicts is that no line should be wider than 80 characters. Since this is a Rails project, we often have strings that are a little...

Use a variable within heredoc in PHP (SQL practice)

I'm a newbie to PHP/SQL and I am trying to use a variable within a heredoc as I need to output a lot of text. I've only included the first sentence as it is enough to show the problem). My problem...

heredoc syntax for multi-line perl using stdin from bash

How to pass file to perl script for processing and also use heredoc syntax for multi-line perl script? I have tried those but no luck: cat ng.input | perl -nae <<EOF if (@F==2) {print $F[0] ....

here-document gives 'unexpected end of file' error

I need my script to send an email from terminal. Based on what I've seen here and many other places online, I formatted it like this: /var/mail -s "$SUBJECT" "$EMAIL" << EOF Here's a line of my...

sprintf argument swapping and HEREDOC

I'm trying to use sprintf on a heredoc this way. It wont work. Any idea how to solve this? $i = <<<EOD This is your invoice for %1$s %1$s %1$s %1$s EOD; $year = '2013'; $i =...

Display image after clicking upload

How to display images right after they clicked the upload button? Here is my HTML Code: form.php <html> <body> <form action="uploadFile.php" method="post" enctype="multipart/form-data"> ...

How to cat <<EOF >> a file containing code?

I want to print code into a file using cat <<EOF >>: cat <<EOF >> brightup.sh !/bin/bash curr=`cat /sys/class/backlight/intel_backlight/actual_brightness` if [ $curr -lt 4477 ]; then ...

How does one escape backticks in markdown?

I am writing some documentation in markdown and I want to document how to create a text file using a bash HEREDOC. Here is the command I want to document: # cat > /tmp/answers.txt <<EOT >...

Dumping many variables in PHP

I assure this is a very common situation when you have to test variables (and they are many!), just like this example (I only named vars like this for less-effort-writing...

How to avoid heredoc expanding variables?

I'm trying to create a script file using substitution string from ENV but want also to prevent some from escaping export PLACEHOLDER1="myPlaceholder1Value" sudo /bin/su -c "cat << EOF >...

What is the Perl syntax to remove extraneous spaces from a Perl heredoc in 'use constant'?

I have the following structure through various pieces of code in my code base. The use of the heredoc is good for myself and others to be able to understand the code, but it provides unnecessary...

Can ES6 template literals be substituted at runtime (or reused)?

tl;dr: Is it possible to make a reusable template literal? I've been trying to use template literals but I guess I just don't get it and now I'm getting frustrated. I mean, I think I get it, but...

Indenting heredocs with spaces

For personal development and projects I work on, we use four spaces instead of tabs. However, I need to use a heredoc, and I can't do so without breaking the indention flow. The only working way...

Golang, importing packages from Github requests me to remember the Github URL?

I'm very new to Golang. I see that in Golang you can import packages directly from Github like: import "github.com/MakeNowJust/heredoc" Does that mean I have to remember this URL in order to use...

cURL config file (-k / --config) JSON newlines

I'm trying to construct a cURL config file that contains newlines in the -d/--data body but it doesn't seem to work the same as on the command line. On the command line I can run: curl -XPUT...

How to use a heredoc in a security group description

I am trying this: resource "aws_security_group" "mysg" { description = <<EOF this is a very long descirpltion...

How to set encoding for a herestring/heredoc in powershell?

I'm attempting to update the hosts file on a Windows server and trying to do it using a heredoc in powershell. I can't figure out why my result has extra spaces between every character in each...

How to make docker COPY ignore file permissions?

I'm pulling a docker image from registry and I want to use it as cache, running locally docker build --cache-from MY_IMAGE .. It uses case up to the layer COPY requirements.txt ${SOME_DIR}. I...

redis-cli how to AUTH using password and issue a command?

When no password is set, we can issue for instance; >> redis-cli keys * or >> redis-cli config set requirepass "aaaaaa" However, after we have have issued the latter, the first no longer...