this BASH script will KILL you.
About this video
In this Bash scripting lesson, Chuck builds a text version of Elden Ring to teach conditionals. The joke starting point is a script named eldenring.sh, made executable with a shebang, that simply echoes ‘you died.’ He then introduces if statements using a coffee yes/no example with read, a variable, double brackets, ‘==’, then, else, and fi to close the statement. The game logic follows: a beast picks a random number using the RANDOM variable with modulo 2, giving 0 or 1, and the player (the ’tarnished’) wins by matching it, a 50/50 chance. A boss battle against Margit hardens the odds to 1 in 10 using modulo 10 and numbers 0 through 9, with ’exit 1’ ending the script on death. Chuck then extends the syntax: comparisons such as greater-than, the OR operator ‘||’ to add a cheat code where typing ‘coffee’ wins the boss fight, the AND operator ‘&&’ requiring both conditions, nested ifs (only the root user can win in his example), and elif for an alternate win condition. Finally he adds class selection with a case statement, ending in esac, assigning different stats to samurai, prisoner, and prophet choices, and challenges viewers to expand the game themselves.
Key takeaways
- Bash conditionals follow the pattern if [[ condition ]]; then … else … fi, letting a script change behavior based on evaluated data
- Using RANDOM with modulo 2 produces 0 or 1 for a 50/50 beast fight; modulo 10 produces 0-9 for the 1-in-10 Margit boss battle
- Adding ’exit 1’ after a death prevents the player from continuing to the next battle in the same run
- The ‘||’ operator adds an OR cheat code (‘coffee’ wins), while ‘&&’ requires both conditions to be true
- Nested ifs, elif branches, and case/esac statements handle layered decisions such as user checks and character-class stat assignment
Episode details: published May 13, 2022 · 29:43 long. Summary written by Self Growth Videos from the episode itself. Business results and any income figures mentioned are NetworkChuck’s own claims, shared for education — they are not typical or guaranteed.
← Previous: deleting stuff from Python Lists // Python RIGHT NOW!! // EP 9 · Next: i created malware with Python (it’s SCARY easy!!) →
All NetworkChuck videos · NetworkChuck profile · NetworkChuck on YouTube





