Introduction to Bash Scripting
Bash is a command language interpreter for the Linux operating system. This tutorial will guide you through writing your own Bash scripts to automate tasks and work more efficiently. Use the navigation menu to begin.
Your First Script
The simplest possible Bash script prints a message to the terminal. It starts with a special line called a "shebang" which tells the operating system to use the Bash interpreter.
#!/bin/bash
echo "Hello World!"
Making a Script Executable
By default, a new script file does not have permission to be executed. You must change its permissions using the `chmod` command.
Add execute permission
chmod +x your_script_name.shThe `chmod +x` command adds the "execute" permission to the file, allowing it to be run as a program.
Running the Script
Execute from the current directory
./your_script_name.shThe `./` prefix tells the shell to look for the script in the current directory.