Remove the First Capital Letter from Each Element

  • + 0 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 "You can't use 'macro parameter character #' in math mode{country/[A-Z]/.}" transformed+=("$transformed_name") done

    Join the transformed names with a space and print the result

    echo "${transformed[*]}"