1700481665
public class Client{
1700481666
1700481667
public static void main(String[]args)throws IOException{
1700481668
1700481669
Invoker invoker=new Invoker();
1700481670
1700481671
while(true){
1700481672
1700481673
//UNIX下的默认提示符号
1700481674
1700481675
System.out.print(”#”);
1700481676
1700481677
//捕获输出
1700481678
1700481679
String input=(new BufferedReader(new InputStreamReader
1700481680
1700481681
(System.in))).readLine();
1700481682
1700481683
//输入quit或exit则退出
1700481684
1700481685
if(input.equals(“quit”)||input.equals(“exit”)){
1700481686
1700481687
return;
1700481688
1700481689
}
1700481690
1700481691
System.out.println(invoker.exec(input));
1700481692
1700481693
}
1700481694
1700481695
}
1700481696
1700481697
}
1700481698
1700481699
Client也很简单,通过一个while循环允许使用者持续输入,然后打印出返回值,运行结果如下:
1700481700
1700481701
#ls
1700481702
1700481703
file1
1700481704
1700481705
file2
1700481706
1700481707
file3
1700481708
1700481709
file4
1700481710
1700481711
#ls-l
1700481712
1700481713
drw-rw-rw root system 1024 2009-8-20 10:23 file1
1700481714
[
上一页 ]
[ :1.700481665e+09 ]
[
下一页 ]