Newbie bash script question
Hello folks. I'm very new to scripting, so forgive the ignorance.
I'm trying to write a bash script that gets the list of files in a directory and puts them into a variable, then checks each entry and outputs them as follows: item1 is a FILE item2 is a DIR item3 is a DIR etc etc. I am able to get the list of files into a variable, but unsure how to get the output I want. If anyone can give any advise, thanks in advance! |
Have a look at man test and whatever bash tutorial you have should also have more on testing
file types. As an example: http://tldp.org/LDP/abs/html/fto.html |
You want the list of files in **one** variable? That does not sound like the way to go...
The standard way to do something like this is with a loop: Code:
for filename in *; do Try it first like this: Code:
for filename in *; do |
Thank you both. That made a world of difference.
|
All times are GMT -5. The time now is 09:05 PM. |