answersLogoWhite

0


Best Answer

Use the file type test:

if [ -d $file ]; then

echo $file is a directory

elif [ -f $file ]; then

echo $file is a file

else

echo $file is not a directory or a file

fi

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In Unix what is the command for Displaying whether a file is a simple file or a directory?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does is command do in Linux?

A command is an instruction from a user to get the computer to do something! A simple example: open a terminal and type the command "man man" (without the quotes) and the result will be the manual page of the man command.Note: The command ls stands for list the files in the current directory.


What is the command to list only one file?

Assuming you are looking for a specific file in a location, it's as simple as ls <name of file.> assuming you are in the directory you expect it to be in.


What is syntax in dos commands?

The most simple DOS command has to be RUN. A way to view files in a particular directory is DIR. To change to a new directory is CD /C. This means if your hard drive is letter C then it will become available as the new directory with CD(change directory). FORMAT C is an example of how to wipe out your hard drive completely to when it was brand new.


What are is the purposes of displaying campaign lawn signs?

The purposes of displaying campaign lawn signs, are simple. By displaying these signs, the public is being notified and constantly reminded of who is running, and what they are running for.


Write a shell script to sort all the files in the current directory in an alphabetical order and direct the sorted list to a new file?

The following simple shell command lists the contents of a directory (verbose), and redirects the output to 'newfile.txt': ls -l > newfile.txt See related links.


How do you search for directories in PHP?

You can check if a directory exists using the file_exists() function. file_exists(\'http://www.example.com/path/to/directory/\'); It returns boolean TRUE if the directory exists; boolean FALSE otherwise. Incorporting this function with a searching algorithym will make a successful directory search engine. Alternatively, you can make the engine very simple, and check if the exact directory name exists.


What is keyboard command for redo?

very simple ctrl+y


How can one go about organizing their cellphone directory?

Simple ways to organize your cellphone directory should start with alphabetization. Everything should fall into place once you have things categorized into this setup.


Simple subject of this sentence get away from the water during a storm?

The simple subject would be 'you' because it is a command.


How can I reverse lookup phone numbers?

If the call is from a commercial organisation then a simple web search should solve the problem. Many phone directory websites offer reverse look up for numbers that are listed in that directory.


Which syllable is stressed in directory?

Director is stressed on the second syllable. A simple way of testing which syllable is stressed is by saying the word aloud. Look for the syllable that you naturally emphasise more in your speech.


What is a instruction?

A micro-instruction is a simple command that makes the hardware operate properly.