Complete the code to print the current shell name using an environment variable.
echo $[1]The SHELL environment variable holds the path to the current shell.
Complete the code to list all files in the current directory using a shell command.
[1] -lThe ls command lists files and directories. The -l option shows details.
Fix the error in the script to correctly check if the shell is Zsh.
if [ "$SHELL" = [1] ]; then echo "You are using Zsh" fi
The SHELL variable holds the shell path. For Zsh, it is usually /bin/zsh.
Fill both blanks to create a script that prints 'Fish shell detected' if the shell is Fish.
if [ $[1] = [2] ]; then echo "Fish shell detected" fi
Use $SHELL to get the shell path and compare it to /bin/fish which is a common Fish shell path.
Fill all three blanks to create a script that prints the shell name without the path.
shell_name=$(basename [1]) echo "Current shell is [2]" # Check if shell is [3]
basename $SHELL extracts the shell name from the path. Then we print it and check if it is 'bash'.