Bash string replacement gives me a "bad replacement"

I have a variable that is a url and I want to replace part of this url in bash, but I keep getting a "bad replacement"

URL="http://hostname/project/branches/Old_Branch/package" SRC="Old_Branch" REP="New_Branch" echo ${$URL/$SRC/$REP}; # desired output is http://hostname/project/branches/New_Branch/package 

Not sure where exactly I'm wrong ...

+4
source share
1 answer
 URL="http://hostname/project/branches/Old_Branch/package" SRC="Old_Branch" REP="New_Branch" echo "${URL/$SRC/$REP}" 

Note no $ sigill for the URL in ${} =)

+13
source

All Articles