0
0
Bash Scriptingscripting~15 mins

Bash vs other shells (Zsh, Fish, sh) in Bash Scripting - Hands-On Comparison

Choose your learning style9 modes available
Compare Bash with Other Shells (Zsh, Fish, sh)
📖 Scenario: You are learning about different command-line shells used in computers. Each shell has its own features and ways to run commands. You want to see how Bash compares to other popular shells like Zsh, Fish, and sh.
🎯 Goal: Create a simple script that stores the names of these shells, adds a description for each, and then prints out the list with their descriptions. This will help you understand the differences in a clear way.
📋 What You'll Learn
Create a dictionary called shells with keys: Bash, Zsh, Fish, sh
Add a variable called highlight_shell set to Bash
Use a for loop with variables shell and description to iterate over shells
Print each shell and its description, marking the highlight_shell with an arrow
💡 Why This Matters
🌍 Real World
Understanding different shells helps you choose the right environment for scripting and daily command-line work.
💼 Career
Many IT and developer jobs require knowledge of shells like Bash and Zsh for automation and system management.
Progress0 / 4 steps
1
Create the shells dictionary
Create a dictionary called shells with these exact entries: 'Bash': 'Common default shell with scripting support', 'Zsh': 'Extended features and customization', 'Fish': 'User-friendly with smart suggestions', 'sh': 'Basic shell for scripting compatibility'
Bash Scripting
Need a hint?

Use curly braces {} to create the dictionary with the exact keys and values.

2
Add a highlight shell variable
Add a variable called highlight_shell and set it to the string 'Bash'
Bash Scripting
Need a hint?

Just assign the string 'Bash' to the variable highlight_shell.

3
Loop over shells and descriptions
Use a for loop with variables shell and description to iterate over shells.items(). Inside the loop, create a variable marker that is '->' if shell equals highlight_shell, otherwise an empty string ''.
Bash Scripting
Need a hint?

Use a for loop with shell, description and a conditional expression for marker.

4
Print the shells with highlight
Inside the for loop, print the marker, the shell name, a colon, and the description. The output should look like: -> Bash: Common default shell with scripting support for the highlighted shell and without arrow for others.
Bash Scripting
Need a hint?

Use an f-string to print the marker, shell, and description in one line.