Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy doesn't Java interpret > in a shell command?
    primarykey
    data
    text
    <p>I have following command that I use from commandline to import a mysql backup - </p> <pre><code>mysql -hlocalhost -uroot -pmysql dpfinal &lt; /home/kshitiz/Desktop/dbdump.sql </code></pre> <p>When I invoke this command from command line it runs fine. But when I use following Java code it doesn't work - </p> <pre><code>String command = "mysql -hlocalhost -uroot -pmysql dpfinal &lt; /home/kshitiz/Desktop/dbdump.sql"; InputStream is = Runtime.getRuntime().exec(command).getInputStream(); InputStreamReader ir = new InputStreamReader(is); BufferedReader br = new BufferedReader(ir); String s = br.readLine(); while(s!= null) { System.out.println(s); s = br.readLine(); } </code></pre> <p>I get following output - </p> <pre><code>mysql Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (i686) using readline 6.2 Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Usage: mysql [OPTIONS] [database] -?, --help Display this help and exit. -I, --help Synonym for -? --auto-rehash Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash. (Defaults to on; use --skip-auto-rehash to disable.) -A, --no-auto-rehash No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. --auto-vertical-output Automatically switch to vertical output mode if the result is wider than the terminal width. -B, --batch Don't use history file. Disable interactive behavior. (Enables --silent.) --character-sets-dir=name Directory for character set files. --column-type-info Display column type information. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload