pipeline {
    agent any

    stages {
        stage('Hello') {
            steps {
                echo 'Hello World'
                echo "check1"
                sh "rm -rf test*"
                sh "mkdir test1"
                sh "mkdir test2"
                sh "echo \$(ls)"
                sh "docker ps"
            }
        }
    }
}

如果需要输出一些查询内容,在linux中是echo $(ls),在这里需要加\转义。