letter.js revision 2:da1e581c933b
1217044Snwhitehorn/* 2217044Snwhitehorn * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 3217044Snwhitehorn * 4217044Snwhitehorn * Redistribution and use in source and binary forms, with or without 5217044Snwhitehorn * modification, are permitted provided that the following conditions 6217044Snwhitehorn * are met: 7217044Snwhitehorn * 8217044Snwhitehorn * - Redistributions of source code must retain the above copyright 9217044Snwhitehorn * notice, this list of conditions and the following disclaimer. 10217044Snwhitehorn * 11217044Snwhitehorn * - Redistributions in binary form must reproduce the above copyright 12217044Snwhitehorn * notice, this list of conditions and the following disclaimer in the 13217044Snwhitehorn * documentation and/or other materials provided with the distribution. 14217044Snwhitehorn * 15217044Snwhitehorn * - Neither the name of Oracle nor the names of its 16217044Snwhitehorn * contributors may be used to endorse or promote products derived 17217044Snwhitehorn * from this software without specific prior written permission. 18217044Snwhitehorn * 19217044Snwhitehorn * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20217044Snwhitehorn * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21217044Snwhitehorn * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22217044Snwhitehorn * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23217044Snwhitehorn * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24217044Snwhitehorn * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25217044Snwhitehorn * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26217044Snwhitehorn * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27217044Snwhitehorn * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28217044Snwhitehorn * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29217044Snwhitehorn * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30217044Snwhitehorn */ 31217044Snwhitehorn 32217044Snwhitehorn/** 33217044Snwhitehorn * Demonstrates "heredoc" feature with "scripting" mode. 34217044Snwhitehorn * 35217044Snwhitehorn * Usage: jjs -scripting letter.js -- <sender> <recipient> 36217044Snwhitehorn */ 37217044Snwhitehorn 38217044Snwhitehorn# This is shell-style line comment 39217044Snwhitehornvar obj = { sender: $ARG[0], recipient: $ARG[1] }; 40217044Snwhitehorn 41217044Snwhitehorn// JavaScript style line comment is ok too. 42217044Snwhitehornprint(<<EOF); 43217044SnwhitehornDear ${obj.recipient}, 44217044Snwhitehorn 45217044SnwhitehornI wish you all the best. 46217044Snwhitehorn 47217044SnwhitehornRegards, 48217044Snwhitehorn${obj.sender} 49217044SnwhitehornEOF 50217044Snwhitehorn