スクリプトから情報を取得したいので、この関数を使用しました
public static HashMap<String, String> getEnvVariables(String scriptFile,String config) {
    HashMap<String, String> vars = new HashMap<String, String>();
    try {
        FileInputStream fstream = new FileInputStream(scriptFile);
        BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
        String strLine;
                          String var= "if [ \"$1\" = \""+config +"\" ] ; then";
        // Read File Line By Line
        while ((strLine = br.readLine()) != null) {
            // use a Scanner to parse the content of each line
            // exclude concatenated variables (export xx:$xx)
            if (strLine.startsWith("export") && !strLine.contains("$")) {
                strLine = strLine.substring(7);
                Scanner scanner = new Scanner(strLine);
                scanner.useDelimiter("=");
                if (scanner.hasNext()) {
                    String name = scanner.next();
                    String value = scanner.next();
                    System.out.println(name+"="+value);
                    vars.put(name, value);
                }
            }
        }
ただし、特定の行から読み始めたい
if [ \"$1\" = \""+config +"\" ] ; then
問題は、行がスペースで始まると、プログラムはファイルが終了したと見なすことです! では、どうすればそれを修正し、プログラムをファイルの最後まで解析できますか? 行が複数のスペースthxで始まる可能性があることを考慮して