Shell script issue with filenames containing spaces

前端 未结 4 892
再見小時候
再見小時候 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:25

    you're actually adding redundant "'" (which your echo invocation shows)

    try this:

    #!/bin/sh
    for f in *
    do
    ls "$f"
    done
    

提交回复
热议问题