我有一个变量,这是一个网址,我想在bash中替换该网址的一部分,但我不断得到“糟糕的替代”
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
不确定我哪里错了…
URL="http://hostname/project/branches/Old_Branch/package" SRC="Old_Branch" REP="New_Branch" echo "${URL/$SRC/$REP}"
请注意,${}中的网址没有$sigill =)