Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/holland97/bash-case-statements


https://github.com/holland97/bash-case-statements

application-installation bash-functions case-statement user-group-management while-loop

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Bash-Case-Statements
In my Bash project, I implemented a menu-driven script utilizing a while loop to repeatedly present a set of options to the user. Inside the loop, a case statement handles user input, executing specific commands based on the chosen option.

1. Create a variable that'll be used in the conditional statement of the while loop.

``
variable-name=1
``

2. Create the options to be displayed for the user, ``echo`` command will be used here.
3. Create a variable that will accept the input from the user

``
read $usrinput
``

4. Begin case statement with task that will be executed based on the option

``
case $usrinput in
``

5. Once satisfied, you can exit the loop by hitting 6