Here is my script:
#!/bin/bash
echo "Digite o local em que deseja instalar o IGRAFU(pressione enter para
instalar em
${HOME}/IGRAFO):"
read caminho
if test -z $caminho
then
caminho="${HOME}/IGRAFO"
fi
echo "O IGRAFU será instalado no diretório: $caminho"
mkdir -pv $caminho
mv -v ./* $caminho
echo "Pronto!"
At 'read caminho' I may receive from the user a path like ~/somefolder. When the script receives that kind of path both mv and mkdir won't make tilde expansion, so it will try to create a ~/somefolder and not /home/username/somefolder and therefore fail.
How do I ensure that the tilde will be converted into the HOME variable?