BASH Scripting #SWIFT sareebro What is a shell script? Script: a writing; a written document – Webster's Dictionary A shell script is an easy-to-use tool for application building that “glues together” system calls, tools, utilities, etc. Shell Scripts can invoke the commands available in Linux. Why? Useful tool for System Administrators Avoid having to retype repetitive commands Scripts become a program – a tool that can easily be customized for a particular application How? #!/bin/bash Start with a sha-bang (#!) Placed at the head of a script #! is a two-byte magic number designating the file type (or executable shell script) Tells your system that this file is a set of commands to be fed to the command interpreter indicated Chmod then execute • Change mode: command lets a user tell the system how much access it should permit a file • Make the BASH script executable chmod +x myscript.sh • Execute your script (dot-slash) ./myscript.sh Demo We shall now make a simple BASH script!