DOT(1P)

πŸ’… DOT(1P) β€” the POSIX Programmer's Manual, bestie edition πŸŽ€

okay so this is the POSIX Programmer's Manual page for dot, and I'm gonna hold your hand through it like the group chat does before a group project. quick heads-up before we even start:

🚨 PROLOG (read this first, fr fr)

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β€” so bestie, consult the corresponding Linux manual page for details of Linux behavior β€” or honestly? the interface may not be implemented on Linux at all. πŸ’€


✨ NAME ✨

dot β€” execute commands in the current environment. that's it. that's the whole vibe. it runs stuff, but in your environment, not a lil baby subshell one. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

. file

that's a single period followed by a filename, and yes it's iconic, yes it's tiny.


🌸 DESCRIPTION 🌸

The shell shall execute commands from the file in the current environment. not a copy, not a spawn, the actual current one. that's the whole point and it's lowkey why people are obsessed.

If file does not contain a <slash>, the shell shall use the search path specified by PATH to find the directory containing file. BUT β€” and this is the plot twist β€” unlike normal command search, the file searched for by the dot utility need not be executable. it just needs to be readable, periodt.

If no readable file is found:

  • a non-interactive shell shall abort. like, gone. πŸ’€
  • an interactive shell shall write a diagnostic message to standard error, but this condition shall not be considered a syntax error.

so the interactive shell lives to fight another day. she's resilient.


πŸŽ€ OPTIONS πŸŽ€

None. literally zero. nothing to configure. she simply is. πŸ’…


πŸ’– OPERANDS πŸ’–

See the DESCRIPTION. (yeah, they really said that. the file operand is the whole thing.)


πŸ™ˆ STDIN πŸ™ˆ

Not used. don't even think about it.


πŸ“ INPUT FILES πŸ“

See the DESCRIPTION. (again. it's the file. that's the input file. slay.)


🌈 ENVIRONMENT VARIABLES 🌈

See the DESCRIPTION. (PATH is the star of the show here, iykyk.)


⭐ ASYNCHRONOUS EVENTS ⭐

Default. no notes.


πŸ¦„ STDOUT πŸ¦„

Not used. she doesn't talk, she just does.


πŸ’œ STDERR πŸ’œ

The standard error shall be used only for diagnostic messages. that's her one job and she does it beautifully.


🧚 OUTPUT FILES 🧚

None. zero. nada.


🫢 EXTENDED DESCRIPTION 🫢

None. this page is refreshingly short and we love her for it.


πŸ‘‘ EXIT STATUS πŸ‘‘

okay bestie, here's where it gets real. If no readable file was found, or if the commands in the file could not be parsed, and the shell is interactive (and therefore does not abort; see Section 2.8.1, Consequences of Shell Errors), the exit status shall be non-zero.

Otherwise, return the value of the last command executed, or a zero exit status if no command is executed. so basically: whatever the last thing in the file did, that's your status. simple. clean. iconic.


πŸ’€ CONSEQUENCES OF ERRORS πŸ’€

Default.

The following sections are informative.


🌸 APPLICATION USAGE 🌸

None. we're all just vibing.


✨ EXAMPLES ✨

look at this lil demo, it's so cute:

cat foobar
foo=hello bar=world
. ./foobar
echo $foo $bar
hello world

see how foo and bar survived past the . call? that's the current-environment thing doing its thing. main character energy. 🫢


πŸ’… RATIONALE πŸ’…

Some older implementations searched the current directory for the file, even if the value of PATH disallowed it. This behavior was omitted from this volume of POSIX.1‐2017 due to concerns about introducing the susceptibility to trojan horses that the user might be trying to avoid by leaving dot out of PATH. so like… yeah. that was a security jumpscare and we said no thank you. 🚫🐴

The KornShell version of dot takes optional arguments that are set to the positional parameters. This is a valid extension that allows a dot script to behave identically to a function. cute! that's not in this volume tho, just so we're clear. πŸ‘€


πŸ”₯ FUTURE DIRECTIONS πŸ”₯

None. she's perfect as she is.


πŸŽ€ SEE ALSO πŸŽ€

  • Section 2.14, Special Built-In Utilities
  • return

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page, bestie!! this iconic lil number is brought to you by IEEE/The Open Group, 2017, and it's filed under DOT(1P). go forth and source responsibly. πŸ¦‹βœ¨πŸ’–

πŸ“¦ where this page comes from