Home Man
Search
Today's Posts
Register

This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in the UNIX for Beginners Questions & Answers forum.

IF -a condition meaning.

Tags
beginners

 

 
Thread Tools Search this Thread
# 1  
Old 10-30-2013
IF -a condition meaning.

Hi All,

Could you please let me know what is the meaning of below -a condition if the if?

Code:
if ! [ -a $SOURCEPATH/$SOURCEFILE_A ]

Thanks in advance for the help.

Last edited by Scrutinizer; 10-30-2013 at 12:14 PM.. Reason: code tags added
# 2  
Old 10-30-2013
# 3  
Old 10-30-2013
Thanks a lot Yoda for the help.
And what is the difference between -a and -f.
It says -f is for regular file and -a is it for any file. Am i correct.?
# 4  
Old 10-30-2013
Quote:
Originally Posted by abhi_123
Thanks a lot Yoda for the help.
And what is the difference between -a and -f.
It says -f is for regular file and -a is it for any file. Am i correct.?
That is correct.

E.g. you can verify this by creating a named pipe (FIFO) using mkfifo:
Code:
$ mkfifo file.pipe
$ [ -a file.pipe ] && echo "True" || echo "False"
True
$ [ -f file.pipe ] && echo "True" || echo "False"
False

# 5  
Old 10-30-2013
Note: -a may happen to be supported for historical reasons, however, it is not part of POSIX so -e should be used instead.

Quote:
An early proposal used the KornShell -a primary (with the same meaning), but this was changed to -e because there were concerns about the high probability of humans confusing the -a primary with the -a binary operator.
test: Rationale
The Following User Says Thank You to Scrutinizer For This Useful Post:
Yoda (10-30-2013)
 

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Meaning lg123 Shell Programming and Scripting 1 09-26-2013 02:18 PM
If condition return 0 even when it fails to satisfy te condition Priya Amaresh Shell Programming and Scripting 2 05-10-2013 01:54 AM
redirect stdout echo command in condition A run in condition B jao_madn Shell Programming and Scripting 3 11-02-2011 09:01 PM
meaning of <<! sudharson UNIX for Dummies Questions & Answers 1 08-01-2011 04:35 PM
Meaning of SDA msarro Red Hat 2 07-06-2011 11:40 AM
Difference between [condition] and [[condition]] and ((condition)) when used with if condition soumyabubun HP-UX 2 05-06-2011 01:03 PM
meaning of &1 Oracle_User Shell Programming and Scripting 2 03-04-2011 02:07 AM
What is the meaning of $_ giri_luck Shell Programming and Scripting 4 01-05-2010 02:11 AM
Meaning of >&2 proactiveaditya Shell Programming and Scripting 4 12-11-2009 09:03 AM
Use and meaning of $* sinpeak UNIX for Dummies Questions & Answers 2 01-09-2009 01:49 AM


All times are GMT -4. The time now is 05:21 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password