heredoc

Can I use a heredoc to enter a password in bash?

I know about RSA authentication, but for my purposes I want to use a heredoc to specify the password. I want something like the following, but I can't get it to work. Is this even possible? #!/bin/bash echo -n "Enter Password: " read -s password ssh myhost << EOL $password echo "I'm logged onto myhost" EOL echo done This is what I g...

Dirt-simple PHP templates... can this work without `eval`?

Update- Thanks for all the responses. This Q is getting kind of messy, so I started a sequel if anyone's interested. I was throwing together a quick script for a friend and stumbled across a really simple way of doing templating in PHP. Basically, the idea is to parse the html document as a heredoc string, so variables inside of it ...

Is it possible to concatenate heredoc string in PHP..?

With normal PHP string you can do this: $str = "Hello "; $str .= "world"; $str .= "bla bla bla"; $str .= "bla bla bla..."; But can you do the same with heredoc string..? $str = <<<EOD Hello world EOD; $str .= <<<EOD bla bla bla"; bla bla bla..."; EOD; ...

conditional statements inside php heredocs syntax?

i was wondering if you can have conditional statments inside a heredocs, this is my script but it deosnt parse out the $username properly? php code: function doSomething($username) { if (isset($_SESSION['u_name'])){ $reply ='<a class ="reply" href="viewtopic.php?replyto=@$username.&status_id=$id&reply_name=$username"> reply </a>'; re...

PHP parse error

i am trying to get player logic in place with those if statements player 1 fires 1st -> player 2 2nd then start over again (an user checks a box)then the unset removes the pieces from the board as they are hit Parse error: syntax error, unexpected '(', expecting ']' in on line 93 the problem is this line of code: ...

Can't find string terminator "str" anywhere before EOF

Why I get this error? use strict; use warnings; my $str = <<str; 88087 23/11/2010 35192 25/07/2010 B3J 5X9 17/08/2011 C8U 5L6 16/08/2011 F4Q 3B4 17/10/2010 D3X 9P4 11/05/2010 O7L 6Z8 28/02/2010 W8L 9P2 05/09/2010 str print $str; my @arr = split/\n/,$str; foreach (@arr) { my @tmp = split/\t/; print "$tmp[...

What is the purpose or here documents in ruby?

Hi, I have read about here documents on the book "The Ruby Programming Language" and didn't understand what is the purpose of here documents and when will you use it on production code. I would be happy if someone can explain and give some examples of usage. regards, ...