Skip to content

Creating this repo for uploading all resources regarding Bash script tutorial

License

Notifications You must be signed in to change notification settings

devopshobbies/bash-script-tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Session7

Challenge six description

Part 1: Reading user input and performing actions based on input.

  • The script prompts the user to enter their favorite color.
  • It then uses a case statement to check if the input is a primary color (red, blue, yellow) or a secondary color (green, orange, purple).
  • remember (red, blue, yellow) should be accepted case-insesitive.
  • The script outputs a message based on the color input.

Part 2: Looping through a sequence of numbers and outputting them.

  • The script uses a for loop to iterate through the numbers 1 to 10.
  • It outputs each number to the console using the echo command.

Hints to remember

  • Always add comments to your script to explain what each section is doing. This makes it easier for others to understand your code and for you to come back to it later.

  • Use descriptive variable names that are easy to understand. This makes your code easier to read and debug.

  • Test your script with different input values to make sure it works as expected.

  • Use exit codes to indicate success or failure of your script. An exit code of 0 means success, while any other value means failure.

  • Use conditional statements like if/else and case to perform different actions based on the user's input.

  • Use loops like for and while to repeat certain actions multiple times.

  • Use sleep to pause the execution of your script for a certain amount of time.

  • Always validate user input to prevent errors or unexpected behavior.

bash-script-tutorial

Bash scripts related to every session of this tutorial will be stored in isolated branches named after their session name.

How to use

You can access the main code and the challenge answer key related to every session at their own branch.

About

Creating this repo for uploading all resources regarding Bash script tutorial

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages