jlaskey@67: /* jlaskey@67: * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. attila@962: * jlaskey@67: * Redistribution and use in source and binary forms, with or without jlaskey@67: * modification, are permitted provided that the following conditions jlaskey@67: * are met: attila@962: * jlaskey@67: * - Redistributions of source code must retain the above copyright jlaskey@67: * notice, this list of conditions and the following disclaimer. attila@962: * jlaskey@67: * - Redistributions in binary form must reproduce the above copyright jlaskey@67: * notice, this list of conditions and the following disclaimer in the jlaskey@67: * documentation and/or other materials provided with the distribution. attila@962: * jlaskey@67: * - Neither the name of Oracle nor the names of its jlaskey@67: * contributors may be used to endorse or promote products derived jlaskey@67: * from this software without specific prior written permission. attila@962: * jlaskey@67: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS jlaskey@67: * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, jlaskey@67: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR jlaskey@67: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR jlaskey@67: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, jlaskey@67: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, jlaskey@67: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR jlaskey@67: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF jlaskey@67: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING jlaskey@67: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS jlaskey@67: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. jlaskey@67: */ attila@962: jlaskey@67: /** jlaskey@67: * JDK-8006191 - `cmd` -> exec("cmd") in script mode jlaskey@67: * jlaskey@67: * @test jlaskey@67: * @option -scripting jlaskey@67: * @argument ArgumentFromCommandLine attila@962: * @run jlaskey@67: */ jlaskey@67: jlaskey@67: #!/usr/bin/jjs jlaskey@67: jlaskey@67: $ENV.PWD = "."; jlaskey@67: print($ENV.PWD); jlaskey@67: jlaskey@67: var files = `ls`.trim().split("\n"); jlaskey@67: for (var i in files) { jlaskey@67: var file = files[i]; jlaskey@67: if (file.contains("README")) { jlaskey@67: print(file); jlaskey@67: } jlaskey@67: } jlaskey@67: jlaskey@67: var result = $EXEC("cat", <