HeadlinesBriefing favicon HeadlinesBriefing.com

Learning Shell Scripting for Computer Automation

Hacker News •
×

For the first few years of my career, I didn't know how to tell my computer to do things beyond simple terminal commands. I could run tests, install dependencies, start containers, and ssh to machines, but I was limited to running simple commands one at a time. My terminal was the world's worst GUI, and I thought the shell was only for starting programs that didn't have application wrappers.

At a fundamental level, I wasn't able to tell my computer to accomplish anything involving logic or stitching together multiple programs. Tasks like running one command after another, logging errors when commands fail, starting programs on boot, running commands in parallel, looping through files, or chaining command outputs were beyond my reach. In theory, I could have used Node JS, but I never did.

This was partially mindset: I wasn't used to thinking about command-line programs as controllable tools. The rest was skill—I didn't know the programs well enough to integrate them into scripts. I kept trying to learn the shell, and slowly I could muddle through scripts with basic logic.

Depending on your familiarity with shell scripting, you might be gibbering right now. Sorry. Even though my early commands and scripts had problems, it was transformational—I suddenly had the ability to stitch together existing programs to accomplish my goals. It felt like learning to program in the first place.