2

I have a small part of a shell script that reads an input file from a user and saves it to a variable img_dir:

read -e -p "Enter img_folder filename: " img_dir

A user will most likely want to enter a folder in the home directory. But this command does not support that tilde thing (what is it called?) "~/xxx", you have to use "/home/usr/xxx". Is there a way to make it support the tilde function?

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
John Lexus
  • 3,576
  • 3
  • 15
  • 33
  • 2
    Tilde expansion is done by the shell, not by your program. You need to tell the shell to evaluate your variable to do that. – Mad Physicist Jul 31 '17 at 14:35

0 Answers0