Exercise: Case Statement and Associative Array

Put to practice what you have learned about case statement and associative arrays.

Exercise 1: case statement

There are two configuration files in the user’s home directory: .bashrc-home and .bashrc-work.

Write a script to switch between them. You can do that by copying one of the files to the path ~/.bashrc or creating a symbolic link. Use the option h for file .bashrc-home and option w for .bashrc-work.

Solve the task with the case statement first by editing switch-config-case.sh.

Get hands-on with 1200+ tech skills courses.