Circle 1: Summoning Basics
Stop typing the same commands over and over. A Bash Script is a magical scroll where you write down a sequence of commands, and the machine executes them for you.
Tactical Intel: The Shebang (#!)
Every script needs a starting "Incantation" to tell the OS which language it's written in. For Bash, it is:
#!/bin/bash
Directive: Scribe and Awaken
Scripts are just text files, but to make them "alive" (runnable), you must grant them Execute Permissions.
booting...
Tactical Objectives
- Scribe the Scroll: Create a file named
summon.sh.- Add
#!/bin/bashon the first line. - Add
echo "Rise, Automator!"on the second line.
- Add
- Awaken the Code: Run
chmod +x summon.shto make it executable. - Perform the Summoning: Run
./summon.shto see your code come to life.
Sorcerer's Insight
In the world of DevOps, we prefix local scripts with ./. This tells the shell to look for the file in the current directory rather than searching through the entire system.