FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » more Linux stuff, this time it is different

   
Author Topic: more Linux stuff, this time it is different
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
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 | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
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 | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
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 | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
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 | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
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 | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
I'm just saying that I have a Linux Manual on recusion so its oh-kay.
IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

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