In Bourne shell and derivates,
Is IFS a shell-builtin, an Environment variable, or something else, by definition?
(How is this program module normally categorized in the literature?)
In Bourne shell and derivates,
Is IFS a shell-builtin, an Environment variable, or something else, by definition?
(How is this program module normally categorized in the literature?)
According to this source, 2. Shell Command Language:
2.5.3 Shell Variables
Variables shall be initialized from the environment (as defined by XBD Environment Variables and the exec function in the System Interfaces volume of POSIX.1-2017) and can be given new values with variable assignment commands. If a variable is initialized from the environment, it shall be marked for export immediately; see the export special built-in. New variables can be defined and initialized with variable assignments, with the read or getopts utilities, with the name parameter in a for loop, with the ${ name= word} expansion, or with other mechanisms provided as implementation extensions.
And specifically IFS
:
IFS A string treated as a list of characters that is used for field splitting, expansion of the
*
special parameter, and to split lines into fields with the read utility. If the value ofIFS
includes any bytes that do not form part of a valid character, the results of field splitting, expansion of*
, and use of theread
utility are unspecified.If
IFS
is not set, it shall behave as normal for an unset variable, except that field splitting by the shell and line splitting by theread
utility shall be performed as if the value ofIFS
is<space> <tab> <newline>
; see Field Splitting.The shell shall set
IFS
to<space> <tab> <newline>
when it is invoked.