Created
June 2, 2022 21:32
-
-
Save shalithasuranga/7692e265f1b566f9569386e6e55fc2b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_short_name() { | |
short_name='' | |
for i in ${!fullname[@]}; do | |
if ((i < ${#fullname[@]} - 1)); then | |
short_name+="${fullname[i]::1}. " | |
else | |
short_name+=${fullname[i]} | |
fi | |
done | |
echo $short_name | |
} | |
read -a fullname | |
echo $(get_short_name $short_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment