Escape tilde to avoid string substitution

'~' was not being used as a literal because bash was expanding it.