Passing bash variable to sed dandelion 12 years ago If you need to pass some variable from bash to sed use double quotes: sed -i "s/$var/replace/g" "$file" Easy.