Skip to main content
1 of 3
konsolebox
  • 1.1k
  • 13
  • 14

You can do this:

#!/bin/bash
declare -A site theme
add_site() {
    local shortcut=$1
    site[$shortcut]=$2
    theme[$shortcut]=$3
}
while IFS= read -r line; do
    case "$line" in
    shortcut=*)
        IFS== read -r __ shortcut <<< "$line"
        ;;
    site=*)
        IFS== read -r __ site <<< "$line"
        ;;
    theme=*)
        IFS== read -r __ theme <<< "$line"
        add_site "$shortcut" "$site" "$theme"
        ;;
    esac
done < your_file.ini

Test output with added echo "$@" on function:

x1 example1.com alpha
x2 example2.com beta
konsolebox
  • 1.1k
  • 13
  • 14