protected String replaceAlias(String line, Session session) throws ShellException {
   boolean changed = true;
   Set<String> appNames = new HashSet<String>();
   while (changed) {
     changed = false;
     String appName = AppCommandParser.parseOutAppName(line);
     String prefixedKey = Alias.ALIAS_PREFIX + appName;
     String alias = (String) AbstractApp.safeGet(session, prefixedKey);
     if (alias != null && appNames.add(alias)) {
       changed = true;
       line = alias + line.substring(appName.length());
     }
   }
   return line;
 }