User account management script
📖 Scenario: You are a system administrator who needs to manage user accounts on a Linux server. You want to automate the process of checking user accounts and their statuses.
🎯 Goal: Create a Bash script that stores a list of user accounts with their statuses, sets a status filter, filters the users based on that status, and then prints the filtered list.
📋 What You'll Learn
Create an associative array called
users with usernames as keys and their statuses as values.Create a variable called
filter_status to hold the status to filter users by.Use a
for loop to iterate over the users array and select users whose status matches filter_status.Print the filtered usernames and their statuses.
💡 Why This Matters
🌍 Real World
System administrators often need to manage user accounts and their statuses on servers. Automating this with scripts saves time and reduces errors.
💼 Career
Knowing how to write scripts for user account management is valuable for roles in IT support, system administration, and DevOps.
Progress0 / 4 steps