sed wants to replace a string, but the replacement result contains special characters, causing sed expression errors, such as
sed -r "s/^url.*$/url=$(pwd)/" rt.conf
The expression $(pwd) contains a slash, which conflicts with the delimiter in sed, so it must be processed first
x=file://$(pwd) #Note the following replacement, x is followed by two //, if only one is connected, only the first one will be replaced. DIR="${x//\//\/}" sed -f "s/^url.*$/url=$x/" rt.conf