Shell script issue with filenames containing spaces

前端 未结 4 890
再見小時候
再見小時候 2021-01-19 03:54

I understand that one technique for dealing with spaces in filenames is to enclose the file name with single quotes: \"\'\".

Why is it that the following code called

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-19 04:22

    What about this ? =)

    #!/bin/sh
    for f in *; do
        printf -- '%s\n' "$f"
    done
    

提交回复
热议问题