Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions bash/readme.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "0dff3f0c-d612-4b82-b7f4-3dcbf01de4d6",
"metadata": {},
"source": [
"# 🚀 Bash Shell Scripting: Your Secret Superpower\n",
"\n",
"Ever felt like you're performing the same boring tasks over and over? Welcome to the club. Bash scripting is like having a magic wand that automates the mundane, leaving you free to solve the *real* problems (or just grab another coffee).\n",
"\n",
"Think of it as the duct tape of the programming world—it's not always pretty, but it gets the job done. This guide will show you how to wield this power responsibly.\n",
"\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "a1fe3c58-35a9-46b1-a264-a9ab5d6420fe",
"metadata": {},
"source": [
"## 💡 Pro Tip: Before You Start\n",
"A Bash script is just a plain text file with a `.sh` extension. The first line is crucial:\n",
"\n",
"```bash\n",
"#!/bin/bash\n",
"```\n",
"This is the \"shebang.\" It tells your system, \"Hey, use the Bash interpreter to run this, not Python or anything else!\" Don't forget it.\n",
"\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "733140d0-05c0-41f4-aeaf-41362ab55edc",
"metadata": {},
"source": [
"## 1. Variables: Storing Your Stuff\n",
"\n",
"Variables are like labeled boxes. You put something in, give it a name, and grab it later.\n",
"\n",
"⚠️ **Gotcha:** No spaces around the `=` sign. Seriously. Bash is picky about this.\n",
"\n",
"```bash\n",
"# Good ✅\n",
"super_secret_password=\"password123\"\n",
"\n",
"# Bad ❌\n",
"super_secret_password = \"password123\"\n",
"```\n",
"\n",
"To use a variable, just put a `$` in front of its name.\n",
"\n",
"```bash\n",
"backup_dir=\"/mnt/data/backups\"\n",
"echo \"Backing up to $backup_dir...\"\n",
"# See? The quotes are important. Try it without them and see what happens.\n",
"# Spoiler: it might break if the path has spaces.\n",
"tar -czf \"$backup_dir/home_$(date +%F).tar.gz\" /home/user/\n",
"```\n",
"\n",
"---"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "003c9ae0-5aaf-439b-82bb-89ee575bb2bf",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading