Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Or... ls could just escape filenames.

I'm not sure why it seemingly doesn't in the year 2021.



From “man ls”:

    -b, --escape
        print C-style escapes for nongraphic characters
I'd also add:

    -1  list one file per line. Avoid '\n' with -q or -b
to make sure you can easily split the list by just the EOL, in case for some reason it thinks it is talking to a terminal and tries for format things for a human.


ls -Q

--quoting-style=xxx

?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: