RewriteCond CondPattern file attributes difference between "-h", "-l" and "-L"?

Maarten Bruins
Maarten Bruins used Ask the Experts™

Is symbolic link, bash convention.
See -l.

Is symbolic link.
Treats the TestString as a pathname and tests whether or not it exists, and is a symbolic link. May also use the bash convention of -L or -h if there's a possibility of confusion such as when using the -lt or -le tests.

Is symbolic link, bash convention.
See -l

What are the differences between these three?

"-h" has "bash concention" and "-l" not. But what is the difference in practise? Can someone give me an example of the difference?

And why it's "-L" and not "-H"? "-L" is about the bash convention, but "-l" not. However, "-h" is. So then I would expect "-H" instead of "-L".

I don't need it for something right now, but I'm trying to understand the Apache documentation.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Do yourself a favor and use...

ln -s

Open in new window

Which will generate a soft link.

Usually -L means the same as -l. There is no -H.

As to why no -H, the answer is same as always with Linux... because... meaning at some point in time, maybe before you were born, someone made up some oddball convention/name, which made sense to them, then the convention/name stuck. There is no rhyme or reason to this. If you think you really must know, then open a ticket with Apache or BASH + ask about the historical background of your interest. There might be an old timer who can answer your question.

Below shows how to create links. What you mention above is all about testing links.

Using hard link types can create massive debugging + backup problems + many times guessing disk space used will be wrong (depending on tool used).

So think of soft links as aliases you can see + hard links are invisible...

Here's an example...

# text file...
imac> cat test.txt
Test data file...

# create a soft + hard link
imac> ln -s test.txt foo.txt
imac> ln -h test.txt foo1.txt

# see the difference...
# soft link is visible
# hard link is invisible, so both file directory entries point to the same first inode in test.txt
# with soft links, if you remove test.txt (original file), then the soft link dangles, returning no data
# with hard links, if you remove test.txt, then foo1.txt still exists, returning data of file.
imac> ll test.txt foo*.txt
-rw-r--r--  1 david  staff   3.6K Jul 22 19:56 foo.1.txt
lrwxr-xr-x  1 david  staff     8B Aug 30 07:06 foo.txt@ -> test.txt
-rw-r--r--  2 david  staff    18B Apr  6  2017 foo1.txt
-rw-r--r--  2 david  staff    18B Apr  6  2017 test.txt

Open in new window

With Apache + almost every other Linux tool, best to always use soft links.


You're sating that -L means the same as -l. If that's true, then all three (-L, -l, -h) are the same.

Then why the description is different?

Is symbolic link.
Is symbolic link, bash convention.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial