
我希望用戶選擇名為“主資料夾”的文件,但如果我只是使用
read foldername
ls $foldername
它,只需分別讀取“主”和“資料夾”一詞(基本上是執行ls main
而不是ls "main folder"
我如何製作,所以它包含read -r foldername
空格?
答案1
您的意思是:將檔案列印到命令列嗎?如果是:
使用cat "filename with spaces.txt"
或cat filename\ with\ spaces.txt
.