import that begins with
../ is considered a relative import.
Relative imports reference a file located relative to the file that is importing it. This provides a mechanism for modularization (breaking up the logic into multiple files) and code forking (for example, importing different implementations of a function based on the shell interpreter).
Relative imports are made possible primarily because of the
Content-Location HTTP headers provided by the server that provides the
When a script is imported, the HTTP headers are parsed, and the final
Content-Location header is considered the "location" of the script.
This final URL gets cached to the filesystem in the
Perhaps an example will help illustrate. If you inspect the response headers for
tootallnate/hello, then you can see
Location header is present:
$ curl -sI https://import.pw/tootallnate/hello | grep -i location location: https://raw.githubusercontent.com/tootallnate/hello/master/hello.sh
import keeps tracks of these URL locations, so that from within the
script, any relative import, let's say
import ./foo.sh, will be normalized to
relative of the current URL location.