Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 2020 09:42:55 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 247410] sh(1): Document that if the dot command fails to find and source the file, the whole script fails
Message-ID:  <bug-247410-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

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@FreeBSD.org
          Reporter: 0mp@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.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-247410-227>