Author
|
Topic: more Linux stuff, this time it is different
|
Blayne Bradley
unregistered
|
posted
So I can get it so that it'lll list every file/directory in my pwd, but alas I also want to indent it in the output say:
----Marxism ----Linux for Dummies.pdf ----TreeCase ----Boom!
so far I can: inDD="--" for i in * do echo $inDD$inDD$i done
however, is there a way to say if incDD=4 then print 4 inDD's?
Also is there a way to differiniate between a file and a directory? Will if(file) or if(dir) work?
IP: Logged |
|
|
Blayne Bradley
unregistered
|
posted
Ok if(file/dir) won't work, the -d,-f options thingies will, so nvm for the file/dir thing.
And it would appear that possibly just making a loop will do in terms of making it bigger. More on this later.
IP: Logged |
|
|
Bokonon
Member
Member # 480
|
posted
Why not use the '\t' character, which inserts spaces equivalent to a tab, rather than dashes?
If you want to list everything in subdirectories of the given directory, try learning about recursive functions.
-Bok
Posts: 7021 | Registered: Nov 1999
| IP: Logged |
|
|
Blayne Bradley
unregistered
|
posted
Actually thats exactly what I need but I have book.
As for dashes, I need em since I'm recreating the tree command.
IP: Logged |
|
|
Bokonon
Member
Member # 480
|
posted
quote: Originally posted by Blayne Bradley: Actually thats exactly what I need but I have book.
Huh? Do a google search on recursion and the shell/tools you are using, I'm sure you'll find some useful pages.
-Bok
Posts: 7021 | Registered: Nov 1999
| IP: Logged |
|
|
Blayne Bradley
unregistered
|
posted
I'm just saying that I have a Linux Manual on recusion so its oh-kay.
IP: Logged |
|
|