Re: Echo Syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That syntax is typical of other 'shells'.  You'll find it used in csh, ksh, etc. scripts.
It's known as a 'HEREIS' document.

Typically you can feed input to just about any unix command from a file:
I use this syntax all the time:

    mailx -s 'the subject' tosomeone@somewhere < message_text_file.txt

When you want to include stuff in-line, in a script, you use a 'hereis' document.  You'll 
usually find something like this:

mailx -s 'thesubject' tosomeone@somewhere <<<EOF
There is a problem with script X, please contact support
EOF

The '<<<' basically means take the input from stdin (currently the script itself) until you 
run into the string "EOF" as the only thing on the input line.  There are arguments both for 
and against using this feature.  I don't particularly care for it.

Larr.

--- In php-objects@xxxxxxxxxxxxxxx, "Atkinson, Robert" <ratkinson@...> wrote:
>
> I came across this use of echo, but can't find any documentation on it.
> 
> Can anyone tell me what the '<<<' is doing?
> 
>  
> function initJSandCSS() {
>   echo <<<SCRIPTS
> .....
>   SCRIPTS;
>  
> }
> 
> 
> Rob.
>




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux