Learn Bash Scripting with freeCodingCamp

Learn Bash Scripting with freeCodingCamp

A Summary of the Bash Scripting Course

ยท

3 min read

Cookies Beware

Here's what I'm currently being greeted with at the onset of this leg of the journey. It's an error I encountered in the last project too. When I click the start course button, it just freezes up on a blank screen when it should be prompting me to log in with CodeAlly.

image.png

Do Not Despair

If this happens to you, you can go straight to CodeAlly and go to the playground there to load into the project.

Or...just go into Chrome's settings and enable third-party cookies. I had mine disabled for Incognito mode which was apparently enough to mess up the login process on the regular browsing mode too.

cookies.png

Commands

Here are some of the commands used in the course

  • sh: uses shell interpreter
  • bash: bourne-again shell...uses the bash interpreter
  • ls -l: list permissions of current directory's files
  • printenv: prints out the environment variables
  • chmod +x <filename>: adds executable permissions to the file
  • help <command>: find out more about a command
  • man <command>: displays the manual for a command if available

The Programs

This course tried my patience. I encountered a lot of technical issues...okay, okay: user issues as well. There were a number of times where I would get one of the five programs to work properly, but because I had not typed it exactly as the tutorial expected, the tests wouldn't pass.

This is exactly how computers are supposed to behave, but this course more than the first two, felt like it was in beta. Just a hair rough around the edges.

That said, it was a fine intro to bash, and we created five working programs:

  1. questionaire.sh: in which we prompt the user for input
  2. countdown.sh: in which we create a timer that counts down every second until it gets to zero
  3. bingo.sh: in which we create conditional statements and a random number to display results based on the random number
  4. fortune.sh in which we create an array, ask the user for a question, check if the question ends in a '?' and then displays a randomly selected answer from the array.
  5. five.sh: in which the program runs the previous four programs one after another

Bash to Basics

Do these seem easy to you? They are if you have any kind of programming experience. But, the syntax of Bash is different from Javascript or Python. And there are built in functions unique to Bash that the course walks through.

On the whole, the two great things you'll get out of this are:

  1. Overview of the command line language Bash
  2. A lot more practice doing things from the command line

Onward to More SQL! ๐Ÿ“ฃ

I'm ready to hop into the next courses which go back into PostgreSQL. Keep an eye on my blog here for updates as I continue through this freeCodeCamp Relational Database Certification.

Thanks! ๐Ÿ‘‹

Thanks for reading. Come say hey over on Twitter, and let me know what you think in the comments below.

Did you find this article valuable?

Support Eamonn Cottrell by becoming a sponsor. Any amount is appreciated!

ย