In the bash script, suppose I have a string val my_str="model-id"
, I want to replace character '-'
with character '/'
. How to do that?
I tried the following way, but it doesn’t work:
echo "$my_tsr" | tr - /
Can some one tell me how to solve it? Thank you!
my_str="model-id"
new_str=${my_str//-//}
echo "$new_str"