A shell script is a plain text file that holds a series of shell commands, meant to be run as a single program. Every line is something you could have typed at the prompt yourself, glued together into a reusable unit.
The point is repeatability. Any command sequence you'd type more than once eventually becomes a script.
#!/bin/bash
echo "hello, DevOps"
Two things worth noticing:
#!, is the shebang. It tells Linux which interpreter to use for this file. #!/bin/bash says "run this with bash."# starts a comment. The shell ignores anything from # to the end of that line.Scripts are usually named something.sh, but the .sh extension
is decorative. Linux doesn't care about the extension, it cares
about the shebang and whether the file is executable. You could
name your script deploy (no extension) and it would work
identically.
That's the whole reality: a shell script is a text file with a shebang that Linux is allowed to run.