You could just assign the non-unique part to a variable:

```ruby
sh_prefix = "cd #{name}/concrete/core/controllers/single_pages && sed -i '.bak' 's/.*{$salt}.*/&\\ $configuration .= "
# Then just put it in the front
sh "#{sh_prefix}\\\"define(\\\\\"PERMISSIONS_MODEL\\\\\", \\\\\"advanced\\\\\");\\\\n\\\";/' install.php"
# etc...
```