I am trying to replace elements on an array using a sed command to compare values between two arrays and replace them accordingly, with the following terminal input:
#!/bin/bash
icons=("" "" "" "" "") #NerdFont icons
classes=("kitty" "firefox" "discord" "steam" "inkscape")
windowClasses=(kitty kitty kitty kitty steam firefox kitty)
echo $(echo $windowClasses | sed "s/${classes[@]}/${icons[@]}/g")
This, however, outputs the following error:
sed: -e expression #1, char 7: unterminated `s' command
I noticed that if I replace the @ symbol for a number as the array selector the code works as expected, but only replaces the elements in the array with the respective elements in the other arrays (kitty becomes but firefox doesn't change, for instance) .