How to properly process and print files with spaces in bash
I'm writing a simple recursive ls program in bash (which I'm very not experienced at, so feel free to be brutal). The program is supposed to print out each file (possibly directory) on a separate line, and each time a new directory is entered, the output is shifted over by 4 spaces, to give it a tree-like output. Currently, it doesn't print out files with spaces correctly, and it doesn't put a forward slash after directories. (More details below.) Code recls () { # store current working directory # issues: seems bad to have cwd defined up here and used down below in getAbsolutePath -- too much
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.