Reputation: 25
I want the output to be something like
|-------File1
|-------File2
|-------Folder
|-------somefile
|-------Makefile
|-------Directory
|-------hi.txt
|-------hello.c
I am writing a bash script to obtain this kind of output. I'm having trouble on how to go about this. I want to do this without using the tree
command.
Upvotes: 1
Views: 42
Reputation: 42107
Don't reinvent the wheel, this is exactly what tree
command does.
Check man tree
to get details.
All popular distros should have tree
(installed or) available in their repositories; so if not installed already you can install it using usual manner.
For example, in Debian (and derivatives):
sudo apt-get install tree
In RPM based distros:
sudo yum install tree
Upvotes: 4