익명 04:54

how to read a file name that icludes spaces

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



Top Answer/Comment:

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.

상단 광고의 [X] 버튼을 누르면 내용이 보입니다