'Run the command in Linux machine, just the same way batch is used in Windows machine

I am new to linux System, there was scenario where through my Jenkinsfile I have to run the command bat 'mvn sonar:sonar -Dsonar.projectKey=testproject -Dsonar.host.url=https://localhostxy.com -Dsonar.login=xyzloginid'on linux machine, but getting an error as I was using batch.

The same batch command is working on window based machine.

Please suggest me an alternate way to run it on Linux based machine.

Jenkinsfile stage as below, its working on Windows, please suggest the changes to make it work on linux based machine.

stage('SonarQube Code QualityCheck') {
        steps {           
            bat 'mvn sonar:sonar -Dsonar.projectKey=testproject -Dsonar.host.url=https://localhostxy.com -Dsonar.login=xyzloginid'            
            }
     }

Thanks in advance for the help.



Solution 1:[1]

Here is the solution:

stage('SonarQube Code QualityCheck') {
  steps {           
    sh 'mvn sonar:sonar -Dsonar.projectKey=testproject -Dsonar.host.url=https://localhostxy.com -Dsonar.login=xyzloginid'            
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Antonio Petricca