how to output file names surrounded with quotes in SINGLE line?

后端 未结 9 958
[愿得一人]
[愿得一人] 2021-02-03 19:47

I would like to output the list of items in a folder in the folowing way:

\"filename1\"  \"filename2\" \"file name with spaces\" \"foldername\" \"folder name wit         


        
9条回答
  •  死守一世寂寞
    2021-02-03 20:26

    for f in *; do printf "'%s' " "$f"; done; echo
    

    Or, thanks to Gordon Davisson:

    printf "'%s' " *; echo
    

    The trailing echo is simply to add a newline to the output.

提交回复
热议问题