Answer the question
In order to leave comments, you need to log in
Linux, Bash, Replace characters in a variable?
How to replace characters in a variable, for example replace spaces with %20
Answer the question
In order to leave comments, you need to log in
${mystring//pattern/replacement}
myurl="test toster"
echo ${myurl// /%20}
Judging by the number of questions on bash, I strongly advise you to read www.tldp.org/LDP/abs/html , there are answers to all your questions.
I will supplement the previous comments, to replace the first match, the construction is used
myurl="test toster testarossa"
echo ${myurl/ /%20}
test%20toster testarossa
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question