import cn.reghao.jutil.jdk.shell.ShellExecutor;
import cn.reghao.jutil.jdk.shell.ShellResult;

import java.util.List;

/**
 * @author reghao
 * @date 2025-05-26 10:29:04
 */
public class ShellTest {
    static void execShell() {
        ShellExecutor shellExecutor = new ShellExecutor();
        String cmd1 = "/usr/bin/nginx -t";
        String cmd2 = "/usr/bin/nginx -s reload";
        List<String> list = List.of(cmd1, cmd2);
        for (String cmd : list) {
            ShellResult shellResult = shellExecutor.exec(cmd.split("\\s+"));
            String result = shellResult.getResult();
            System.out.println(result);
        }
    }

    public static void main(String[] args) {
        execShell();
    }
}
