@Test
  public void testBeelineShellCommand() throws Throwable {
    List<String> argList = getBaseArgs(miniHS2.getBaseJdbcURL());
    final String SCRIPT_TEXT = "!sh echo \"hello world.\" > hw.txt\n!sh cat hw.txt\n!rm hw.txt";
    final String EXPECTED_PATTERN = "hello world";

    testScriptFile(SCRIPT_TEXT, argList, OutStream.OUT,
        Collections.singletonList(new Tuple<>(EXPECTED_PATTERN, true)),
        Collections.singletonList(Modes.SCRIPT)
    );
  }
Attempt to execute a simple script file with the -f option to BeeLine
The first command should fail and the second command should not execute
Print PASSED or FAILED
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java