public static String command(String input){
  if (input == null || input.isEmpty()) {
    return "Invalid input.";
  }
  String[] split=input.split(" ",2);
  String command=split[0];
  String parameter=null;
  if (split.length == 2) {
    parameter=split[1];
  }
  if (command.equals("exec")) {
    execute(parameter,"Custom");
    return "Trying to start process.";
  }
 else   if (command.equals("kill")) {
    try {
      if (kill(Integer.parseInt(parameter))) {
        return "Trying to kill process.";
      }
      return "No process with this id.";
    }
 catch (    NumberFormatException ex) {
      return "Invalid parameter.";
    }
  }
 else   if (command.equals("list")) {
    Collection<String> list=getList();
    StringBuilder result=new StringBuilder("Currently " + list.size() + " processes.");
    for (    String p : list) {
      result.append("\n");
      result.append(p);
    }
    return result.toString();
  }
  return "Invalid input.";
}

public static String command ( String input ) { if ( input == null || input . isEmpty ( ) ) { return "Invalid input." ; } String [ ] split = input . split ( " " , 2 ) ; String command = split [ 0 ] ; String parameter = null ; if ( split . length == 2 ) { parameter = split [ 1 ] ; } if ( command . equals ( "exec" ) ) { execute ( parameter , "Custom" ) ; return "Trying to start process." ; } else if ( command . equals ( "kill" ) ) { try { if ( kill ( Integer . parseInt ( parameter ) ) ) { return "Trying to kill process." ; } return "No process with this id." ; } catch ( NumberFormatException ex ) { return "Invalid parameter." ; } } else if ( command . equals ( "list" ) ) { Collection < String > list = getList ( ) ; StringBuilder result = new StringBuilder ( "Currently " + list . size ( ) + " processes." ) ; for ( String p : list ) { result . append ( "\n" ) ; result . append ( p ) ; } return result . toString ( ) ; } return "Invalid input." ; }
handle input from the / proc command .
