> ## 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.

# Bash Readable Check

The `-r` operator is a unary file test operator used within Bash conditional expressions to evaluate file existence and read permissions. It returns an exit status of `0` (true) if the specified file exists and the executing process has read access to it, based on the effective user ID. Otherwise, it returns `1` (false).

```bash theme={"dark"}
[ -r FILE ]
[[ -r FILE ]]
test -r FILE
```

## Evaluation Mechanics

* **Permission Resolution:** The operator evaluates the standard POSIX file permissions (owner, group, other) and Access Control Lists (ACLs) against the effective user ID (EUID) and effective group ID (EGID) of the process executing the Bash script.
* **Symbolic Links:** The `-r` operator dereferences symbolic links. If the target `FILE` is a symlink, the operator evaluates the existence and read permissions of the resolved target file, not the link itself.
* **Directories:** In Unix-like systems, directories are treated as files. The `-r` operator will return true for a directory if the executing user has read permissions for it (which permits reading the directory's contents/listing files).
* **Non-existent Files:** If the file does not exist in the filesystem, the operator short-circuits and evaluates to false without throwing an error.

## Syntax Contexts

The operator functions identically across the three primary Bash conditional constructs, though the parsing engine differs:

1. **`test` built-in:** The POSIX-compliant command-line utility.

```bash theme={"dark"}
test -r /path/to/file
```

2. **`[ ]` (Single bracket):** The POSIX-compliant syntactic sugar for the `test` command. Requires spaces around the brackets and operator.

```bash theme={"dark"}
[ -r /path/to/file ]
```

3. **`[[ ]]` (Double bracket):** The Bash-specific extended test keyword. It handles word splitting and pathname expansion more safely than single brackets.

```bash theme={"dark"}
[[ -r $filename ]]
```

## Disambiguation: `read -r`

While `-r` is a unary operator in the context of conditional tests, it is also frequently encountered as an option (flag) for the `read` built-in command (`read -r`). In the context of `read`, `-r` is not an operator; it is a flag that disables backslash escaping, forcing the command to treat backslashes as literal characters rather than escape sequences.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Bash Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
