0
0
Jenkinsdevops~3 mins

Why Shell steps (sh, bat) in Jenkins? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if you never had to type the same commands again and still get perfect results every time?

The Scenario

Imagine you have to run a series of commands on different computers manually, typing each command one by one in a terminal or command prompt.

You need to do this every time you want to build or test your software.

The Problem

This manual way is slow and boring.

You might forget a command or make a typo.

It's hard to repeat the exact same steps every time, and mistakes can cause big problems.

The Solution

Shell steps in Jenkins let you write those commands once in a script.

Jenkins runs them automatically on the right machine, every time, without mistakes.

This saves time and makes your work reliable.

Before vs After
Before
Open terminal
Type: git pull
Type: ./build.sh
Type: ./test.sh
After
sh 'git pull'
sh './build.sh'
sh './test.sh'
What It Enables

You can automate complex tasks easily and run them anytime with one click.

Real Life Example

A developer pushes code to a shared repository.

Jenkins automatically runs shell steps to build the app and run tests without anyone typing commands.

Key Takeaways

Manual command typing is slow and error-prone.

Shell steps automate running commands in Jenkins.

This makes builds and tests fast, reliable, and repeatable.