Skip to content

Latest commit

 

History

History

0x03-shell_variables_expansions

0x03. Shell, init files, variables, and expansions - DevOps Project

This project is part of the DevOps curriculum and focuses on enhancing your shell scripting skills. You'll work with shell initialization files, environment variables, alias creation, arithmetic operations, and more. The tasks are designed to help you become proficient in shell scripting, which is crucial for DevOps engineers.

Learning Objectives

By completing this project, you are expected to achieve the following learning objectives:

  • Understand the role of shell initialization files.
  • Distinguish between local and global variables.
  • Master the usage of expansions in shell scripting.
  • Create and manage aliases effectively.
  • Perform arithmetic operations within shell scripts.
  • Implement text encoding and decoding using rot13 encryption.
  • Work with different number bases in shell scripts.

Project Structure

The project is organized into a series of tasks, each focusing on a specific aspect of shell scripting:

    • 0-alias: Create a script that sets up an alias for the ls command, allowing you to remove all files in the current directory with a single command.
  1. Hello you

    • 1-hello_you: Create a script that greets the current Linux user by printing "hello user."
  2. The path to success is to take massive, determined action

    • 2-path: Expand your system's PATH variable by adding /action as the last directory to be searched for programs.
  3. If the path be beautiful, let us not ask where it leads

    • 3-paths: Write a script to count the number of directories in the PATH variable.
  4. Global variables

  5. Local variables

    • 5-local_variables: Write a script that lists both local and environment variables, including functions.
  6. Local variable

  7. Global variable

  8. Every addition to true knowledge is an addition to human power

    • 8-true_knowledge: Write a script that performs an arithmetic operation by adding 128 to the value stored in the TRUEKNOWLEDGE environment variable.
  9. Divide and rule

    • 9-divide_and_rule: Create a script that calculates the result of dividing POWER by DIVIDE, where POWER and DIVIDE are environment variables.
  10. Love is anterior to life, posterior to death, initial of creation, and the exponent of breath

    • 10-love_exponent_breath: Build a script that calculates and displays the result of raising BREATH to the power of LOVE, where BREATH and LOVE are environment variables.
  11. There are 10 types of people in the world -- Those who understand binary, and those who don't

    • 11-binary_to_decimal: Write a script to convert a binary number stored in the BINARY environment variable to its decimal equivalent.
  12. Combination

    • 12-combinations: Generate all possible combinations of two lowercase letters (excluding "oo") and print them alphabetically.
  13. Floats

    • 13-print_float: Create a script that prints a number stored in the NUM environment variable with exactly two decimal places.
  14. Decimal to Hexadecimal (Advanced)

  15. Everyone is a proponent of strong encryption (Advanced)

    • 101-rot13: Develop a script that encodes and decodes text using the rot13 encryption method.
  16. The eggs of the brood need to be an odd number (Advanced)

    • 102-odd: Write a script that prints every other line from the input, starting with the first line.
  17. I'm an instant star. Just add water and stir. (Advanced)

    • 103-water_and_stir: Create a script that performs base conversion using environment variables WATER and STIR, storing the result in the base BESTCHOL.

Resources

Read or watch:

man or help:

printenv set unset export alias unalias . source printf

For detailed instructions and examples, refer to the respective script files in this repository.


Special Thanks for Project Guidance to

  • Julien Barbier

YouTube | Twitter | LinkedIn

License

This project is licensed under the terms of the MIT License.


© 2023 ALX. All rights reserved.