1 /* 2 * Copyright (C) 2016 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy of 6 * the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16 17 package com.googlecode.android_scripting.interpreter.shell; 18 19 import com.googlecode.android_scripting.interpreter.Interpreter; 20 import com.googlecode.android_scripting.language.ShellLanguage; 21 22 import java.io.File; 23 24 /** 25 * Represents the shell. 26 * 27 */ 28 public class ShellInterpreter extends Interpreter { 29 private final static String SHELL_BIN = "/system/bin/sh"; 30 ShellInterpreter()31 public ShellInterpreter() { 32 setExtension(".sh"); 33 setName("sh"); 34 setNiceName("Shell"); 35 setBinary(new File(SHELL_BIN)); 36 setInteractiveCommand(""); 37 setScriptCommand("%s"); 38 setLanguage(new ShellLanguage()); 39 setHasInteractiveMode(true); 40 } 41 hasInterpreterArchive()42 public boolean hasInterpreterArchive() { 43 return false; 44 } 45 hasExtrasArchive()46 public boolean hasExtrasArchive() { 47 return false; 48 } 49 hasScriptsArchive()50 public boolean hasScriptsArchive() { 51 return false; 52 } 53 getVersion()54 public int getVersion() { 55 return 0; 56 } 57 58 @Override isUninstallable()59 public boolean isUninstallable() { 60 return false; 61 } 62 63 @Override isInstalled()64 public boolean isInstalled() { 65 return true; 66 } 67 } 68