Replace ~ with ${HOME}.