This is topic more Linux stuff, this time it is different in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=039723

Posted by Blayne Bradley (Member # 8565) on :
 
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?
 
Posted by Blayne Bradley (Member # 8565) on :
 
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.
 
Posted by Bokonon (Member # 480) on :
 
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
 
Posted by Blayne Bradley (Member # 8565) on :
 
Actually thats exactly what I need but I have book.

As for dashes, I need em since I'm recreating the tree command.
 
Posted by Bokonon (Member # 480) on :
 
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
 
Posted by Blayne Bradley (Member # 8565) on :
 
I'm just saying that I have a Linux Manual on recusion so its oh-kay.
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2