Here's what I'm trying. What I want is the last echo to say "one two three four test1..." as it loops. It's not working; read line is coming up empty. Is there something subtle here or is this just not going to work?
array=( one two three )
echo ${array[@]}
#one two three
array=( ${array[@]} four )
echo ${array[@]}
#one two three four
...
One of Vim's great strengths is object-select, offering quick manipulation of content inside words, paragraphs and assorted delimiters.
For example,
vi{
will select everything inside a pair of {} braces.
Is there any equivalent functionality for selecting a here document or heredoc:
<<<HTML
....
....
HTML;
...
I'm writing the code for a controller method and I need to use it to send an email. I'm trying to use heredoc syntax to fill in the email body, however, the closing tag doesn't seem to be recognized.
$this->email = new Email();
$this->email->from = 'Automated Email';
$this->email->to = '[email protected]';
$this->email->subject = 'A new ...
In python I can construct a HTML string without worrying about escaping special characters like < or " by simply enclosing the string in triple quotes like:
html_string = """
<html>
<body>
<p>My text with "quotes" and whatnot!<p>
</body>
</html>
"""
Is there a similar way to do this in Java?
...
How can I write a here document to a file in bash script?
...
<?php
$output = <<< END
<table style="display: table;" class="listview rowstyle-rowhighlight" id="resourcegrid">
<thead>
<tr>
<th width="70"></th>
<th style="-moz-user-select: none;" class="sortable fd-column-0"><a class="fdTableSortTrigger" href="#">Name</a></th>
...
I tried this but only got a syntax error:
<?php
$a = true;
$str = <<< EOF
{$a ? 1 : 2}
EOF;
echo $str;
Is it possible to use such kind of conditional statement inside heredoc?
...
If the title hasn't scared you away yet, read on. I'm working on an ExpressionEngine website and I'm editing the member templates file. All templates that relate to member interaction are stored as functions inside of a class in one single file.
Each of these functions is a simple here document, but many of them print code with paths ...
This is the weirdest thing that has ever happened to me sime I am a (PHP) programmer...
I have two files, with the following code (proj. euler stuff) that return different outputs.
<?php
$numbers =<<<eot
2,3
5,2
9,3
4,9
6,3
10,5
eot;
$numbers = explode("\n",$numbers);
$max = 0;
foreach($numbers as $k => $n){
list($base,$expo) = exp...
If I have a method
def some_method p = {}
string = <<-MY_TERMINATOR
Example text blah blah
lorem ipsum something or another
MY_TERMINATOR
end
how can I access the variable p[:name] from within the heredoc?
...
In scala, "here docs" is begin and end in 3 "
val str = """Hi,everyone"""
But what if the string contains the """? How to output Hi,"""everyone?
...
val name = "mike"
val str = """Hi, {name}!"""
println(str)
I want it output the str as Hi, mike!, but failed. How to do this?
...
substr($obj_strptime,index($strptime,"sub")+6,0) = <<'ESQ';
shift; # package
....
....
ESQ
What is this ESQ and what is it doing here. Please help me understand these statements;
...
Is there a heredoc notation for strings in C#, preferably one where I don't have to escape anything (including double quotes, which are a quirk in verbatim strings)?
...
For example:
$sql = <<<MySQL_QUERY
Thank you!
...
I have a php function that dynamically queries a database, and returns 6 tables. I want to store each of these tables as a php array element, pass the array back via JSON/AJAX, and display each table as a seperate on a page. I wrote test code to do all of this. The test code takes an array of HTML strings and passes them back.
The prob...
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 << EOF
coffee\t$1.50
tea\t$1.50
burger\t$5.00
EOF
UPDATE:
Issues dealt with in this question:
Expanding the tab character
While not expanding the dollar sign
Embedding a he...
<?php
$information = <<<INFO
Name: John Smith
Address: 123 Main St
City: Springville, CA
INFO;
echo $information;
?>
Result:
Parse error: syntax error, unexpected T_SL on line 3
...
Hi All,
I'm having a problem with a Ruby heredoc i'm trying to make. It's returning the leading whitespace from each line even though i'm including the - operator, which is supposed to suppress all leading whitespace characters. my method looks like this:
def distinct_count
<<-EOF
\tSELECT
\t CAST('#{name}' AS V...
Is Heredoc in MVC a good way to begin my foray into separating layers? I read one place it could be use and another that heredoc had more problems than it solved.
...