LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2011, 01:32 PM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
flag to test is not directory


Hi, I found that this tests if a give filename is a directory or not:
Code:
-d "$FILENAME"
But what test for not a directory? I tried
Code:
-D "$FILENAME"
But this doesnt work?
Thanks
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-25-2011, 01:36 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Assuming bash/(pd)ksh:

Code:
if [[ ! -d "$FILENAME" ]] ; then
Hope this helps.
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script directory test rwills Linux - General 10 11-21-2009 06:59 AM
cd: ./test-2.3.0/BUILD: No such file or directory powah Linux - Software 1 01-06-2008 10:05 PM
test.c:1:19: error: stdio.h: No such file or directory Lokathor Debian 2 09-14-2006 12:11 PM
How to test file is a directory in shell judgex Programming 2 06-05-2006 04:25 AM
test.c:1:19: Stdio.h: No such file or directory :( wogga Linux - Software 1 06-11-2004 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration