Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt

Use this file to discover all available pages before exploring further.

The -L operator is a unary file test operator in Bash used to determine whether a specified path exists and is a symbolic link (symlink). When evaluated within a conditional expression, it inspects the file metadata without dereferencing the link to its target. Syntax
[ -L FILE ]
[[ -L FILE ]]
test -L FILE
Technical Characteristics
  • Exit Status: Returns 0 (true) if FILE exists and is a symbolic link. Returns 1 (false) if FILE does not exist or is any other file type (e.g., regular file, directory, block device).
  • Target Resolution: Unlike operators such as -e or -f, -L operates strictly on the symlink’s inode. It does not follow or resolve the link to evaluate the target file.
  • Dangling/Broken Links: The operator evaluates to 0 (true) even if the symbolic link points to a non-existent target. The existence of the link itself satisfies the condition.
  • Equivalence: In Bash, the -h operator is functionally identical to -L and is maintained for POSIX compliance and historical compatibility. Both evaluate the exact same metadata.
Master Bash with Deep Grasping Methodology!Learn More