You are viewing a single comment's thread. Return to all comments →
countries=()
while IFS= read -r line; do countries+=("$line") done
transformed=()
for country in "You can't use 'macro parameter character #' in math mode{country/[A-Z]/.}" transformed+=("$transformed_name") done
echo "${transformed[*]}"
Seems like cookies are disabled on this browser, please enable them to open this website
Remove the First Capital Letter from Each Element
You are viewing a single comment's thread. Return to all comments →
!/bin/bash
Declare an array to hold the country names
countries=()
Read countries from input (one per line)
while IFS= read -r line; do countries+=("$line") done
Initialize an array for transformed names
transformed=()
Loop through each country name in the array
for country in "{country/[A-Z]/.}" transformed+=("$transformed_name") done
Join the transformed names with a space and print the result
echo "${transformed[*]}"