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 * @author Damon Kohler (damonkohler@gmail.com) 28 */ 29 public class ShellInterpreter extends Interpreter { 30 private final static String SHELL_BIN = "/system/bin/sh"; 31 ShellInterpreter()32 public ShellInterpreter() { 33 setExtension(".sh"); 34 setName("sh"); 35 setNiceName("Shell"); 36 setBinary(new File(SHELL_BIN)); 37 setInteractiveCommand(""); 38 setScriptCommand("%s"); 39 setLanguage(new ShellLanguage()); 40 setHasInteractiveMode(true); 41 } 42 hasInterpreterArchive()43 public boolean hasInterpreterArchive() { 44 return false; 45 } 46 hasExtrasArchive()47 public boolean hasExtrasArchive() { 48 return false; 49 } 50 hasScriptsArchive()51 public boolean hasScriptsArchive() { 52 return false; 53 } 54 getVersion()55 public int getVersion() { 56 return 0; 57 } 58 59 @Override isUninstallable()60 public boolean isUninstallable() { 61 return false; 62 } 63 64 @Override isInstalled()65 public boolean isInstalled() { 66 return true; 67 } 68 } 69