package ch.ethz.ssh2; /** * Contains constants that can be used to specify what conditions to wait for on * a SSH-2 channel (e.g., represented by a {@link Session}). * * @see Session#waitForCondition(int, long) * * @author Christian Plattner, plattner@inf.ethz.ch * @version $Id: ChannelCondition.java,v 1.6 2006/08/11 12:24:00 cplattne Exp $ */ publicabstractinterface ChannelCondition { /** * A timeout has occurred, none of your requested conditions is fulfilled. * However, other conditions may be true - therefore, NEVER use the "==" * operator to test for this (or any other) condition. Always use * something like <code>((cond & ChannelCondition.CLOSED) != 0)</code>. */ publicstaticfinalint TIMEOUT = 1; /** * The underlying SSH-2 channel, however not necessarily the whole connection, * has been closed. This implies <code>EOF</code>. Note that there may still * be unread stdout or stderr data in the local window, i.e, <code>STDOUT_DATA</code> * or/and <code>STDERR_DATA</code> may be set at the same time. */ publicstaticfinalint CLOSED = 2; /** * There is stdout data available that is ready to be consumed. */ publicstaticfinalint STDOUT_DATA = 4; /** * There is stderr data available that is ready to be consumed. */ publicstaticfinalint STDERR_DATA = 8; /** * EOF on has been reached, no more _new_ stdout or stderr data will arrive * from the remote server. However, there may be unread stdout or stderr * data, i.e, <code>STDOUT_DATA</code> or/and <code>STDERR_DATA</code> * may be set at the same time. */ publicstaticfinalint EOF = 16; /** * The exit status of the remote process is available. * Some servers never send the exist status, or occasionally "forget" to do so. */ publicstaticfinalint EXIT_STATUS = 32; /** * The exit signal of the remote process is available. */ publicstaticfinalint EXIT_SIGNAL = 64; }
当我们把myTest.sh修改为如下内容:
echo $1 $2 $# print $1
由于我使用的linux机器上没有print命令,所以print $1会报错:command not found。
接下来再让我们执行一下,看看控制台的结果:
outStr=java Know 3 outErr=/sshapp/myshell/myTest.sh: line 2: print: command not found 127