Purchase Solution

Listing current directory entries using Bash

Not what you're looking for?

Ask Custom Question

Write a Bash shell script that will:
+ use as its input the current directory from which it is run
+ print the count and the name of the file, for each file
+ assign and print either "[DIR]", "[FIL]", or "[UNK]" for each file, based on the file's type
+ have the output of the general form:
[TYP] : count : file_name

Example:
[FIL] : 01 : dog
[FIL] : 02 : cat
[DIR] : 03 : colors
[FIL] : 04 : horse
[FIL] : 05 : pig.

Purchase this Solution

Solution Summary

Attached Bash script is well commented and self-explanatory.

Solution Preview

Please find the following solution attached as 265984.sh as well. Remember to "chmod +x 265984.sh" before you attempt to run the script like "./265984.sh". Alternatively you can also run the script as "bash 265984.sh".

#
# Declare a counter
#
count=1

#
# Go ...

Purchase this Solution


Free BrainMass Quizzes
C# variables and classes

This quiz contains questions about C# classes and variables.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.