#!/bin/bash # Ask the user for his/her choice echo "Do you want to count unique words case sensitively? (Y/N)" read -r answer # Convert the answer to lowercase to handle both cases answer=$(echo "$answer" | tr '[:upper:]' '[:lower:]') # Execute the appropriate command based on user input if [[ "$answer" == "y" ]]; then # Case-sensitive counting echo "Counting unique words case sensitively..." cat task_input.sh | awk '{$1=$1; print}' | sort | uniq -c | awk '{print $2, $1}' | sort else # Case-insensitive counting echo "Counting unique words case insensitively..." cat task_input.sh | tr '[:upper:]' '[:lower:]' | awk '{$1=$1; print}' | sort | uniq -c | awk '{print $2, $1}' fi