Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the shell's `source` POSIX-standard?

Tags:

I've spent some quality time searching the POSIX standard for the shell for the source and . commands, and am at this point convinced that they're just not in there.

Are there any shells that don't support the .? What is the POSIX-standard way of executing a shell script in the current environment (i.e., not spawning a subshell, so if the script says export VAR=value then VAR exists in the calling shell)?

I might be missing something obvious, but it turns out that . is not very easy to Google...

like image 907
bk. Avatar asked Jul 21 '12 00:07

bk.


People also ask

What are POSIX standards?

POSIX standards define application programming interfaces (API) at both the system and user levels and command-line shells and utility interfaces for software compatibility and/or portability with various distributions of the Unix Operating System and other operating systems as well.

Is Fish shell POSIX compliant?

fish, the friendly interactive shell, is a commandline shell intended to be interactive and user-friendly. fish is intentionally not fully POSIX compliant, it aims at addressing POSIX inconsistencies (as perceived by the creators) with a simplified or a different syntax.

Which shells are POSIX compliant?

Some popular shell languages are POSIX-compliant (Bash, Korn shell), but even they offer additional non-POSIX features which will not always function on other shells. The commands test expression is identical to the command [expression] . In fact, many sources recommend using the brackets for better readability.

Is Bourne shell POSIX compliant?

Other shells Bash (the Bourne-Again shell) was developed in 1989 for the GNU project and incorporates features from the Bourne shell, csh, and ksh. It is meant to be POSIX-compliant.


1 Answers

It's there under "dot".

NAME

dot - execute commands in the current environment

SYNOPSIS

. file

[etc.]

like image 185
Nemo Avatar answered Jan 03 '23 10:01

Nemo