I've browsed questions for splitting input based on a character but can't quite figure out multiple characters based on a condition:
Say I had a simply bash script that split input separated by spaces into an array:
echo "Terms:"
read terms // foo bar hello world
array=(${terms// / }) // ["foo", "bar", "hello", "world"]
I want an extra condition where if terms are encapsulated by another character, the whole phrase should be split as one.
e.g. encapsulated with a back tick:
echo "Terms:"
read terms // foo bar `hello world`
{conditional here} // ["foo", "bar", "hello world"]
foo bar `hello world`foo bar 'hello world'