SyntaxFix
Write A Post
Hire A Developer
Questions
Sounds like a job for set with a custom IFS.
set
IFS
IFS=- set $STR var1=$1 var2=$2
(You will want to do this in a function with a local IFS so you don't mess up other parts of your script where you require IFS to be what you expect.)
local IFS