how to read a file name that icludes spaces
I want the user to choose the file named "main folder"
but if i just use
read foldername
ls $foldername
it just reads the words "main" and "folder" separately (basically executing ls main
instead of ls "main folder"
how can i make so it includes spaces ?
I have tried read -r foldername
but no luck
Solution 1:
Did you mean: Print the file out to the command line? If yes:
Use cat "filename with spaces.txt"
or cat filename\ with\ spaces.txt
.