[Bug 247410] sh(1): Document that if the dot command fails to find and source the file, the whole script fails

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jun 19 09:42:55 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247410

            Bug ID: 247410
           Summary: sh(1): Document that if the dot command fails to find
                    and source the file, the whole script fails
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: needs-patch
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: 0mp at FreeBSD.org

Let's consider the following script:

```
echo 1
[ 
echo 2
. /nonexistent
echo 3
```

The output of the script is:

```
1
[: missing ]
2
.: cannot open /nonexistent: No such file or directory
```

As we can see, the dot builtin does aborts the script if it cannot source the
desired file, while some other builtins, like [ in this example, just print an
error message and let the script proceed.

We should probably document this behavior.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list