对shell ls 显示有空格的处理及cd 有空格的文件夹

for folder in `ls|tr " " "?"`
 do
  # 如果所目录的情况
  folder=${folder//'?'/' '}

 cd "$folder"

done

转自:https://blog.csdn.net/dqswuyundong/article/details/7427467