The R Project SVN R

Rev

Rev 77439 | Rev 77488 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 77439 Rev 77442
Line 4355... Line 4355...
4355
Bash extensions also need to be avoided in shell scripts, including
4355
Bash extensions also need to be avoided in shell scripts, including
4356
expressions in Makefiles (which are passed to the shell for processing).
4356
expressions in Makefiles (which are passed to the shell for processing).
4357
Some @R{} platforms use strict@footnote{For example, @command{test}
4357
Some @R{} platforms use strict@footnote{For example, @command{test}
4358
options @option{-a} and @option{-e} are not portable, and not supported
4358
options @option{-a} and @option{-e} are not portable, and not supported
4359
in the AT&T Bourne shell used on Solaris 10/11, even though they are in
4359
in the AT&T Bourne shell used on Solaris 10/11, even though they are in
4360
the 2008 POSIX standard.  Nor does Solaris support @samp{$(@var{cmd})}.}
4360
the POSIX standard.  Nor does Solaris support @samp{$(@var{cmd})}.}
4361
Bourne shells: the @R{} toolset on Windows and some Unix-alike OSes use
4361
Bourne shells: the @R{} toolset on Windows and some Unix-alike OSes use
4362
@command{ash} (@uref{https://en.wikipedia.org/@/wiki/@/Almquist_shell}),
4362
@command{ash} (@uref{https://en.wikipedia.org/@/wiki/@/Almquist_shell}),
4363
a rather minimal shell with few builtins.  Beware of assuming that all
4363
a rather minimal shell with few builtins.  Beware of assuming that all
4364
the POSIX command-line utilities are available, especially on Windows
4364
the POSIX command-line utilities are available, especially on Windows
4365
where only a minimal set is provided for use with @R{}.
4365
where only a minimal set is provided for use with @R{}.
Line 4377... Line 4377...
4377
export FOO=value
4377
export FOO=value
4378
@end example
4378
@end example
4379
@noindent
4379
@noindent
4380
which is bash-specific (first set the variable then export it by name).
4380
which is bash-specific (first set the variable then export it by name).
4381
 
4381
 
4382
@code{test -e} (or @code{[ -e ]} in shell scripts is not portable:
4382
Using @code{test -e} (or @code{[ -e ]}) in shell scripts is not
4383
@code{-f} is normally what is intended.
4383
portable: @code{-f} is normally what is intended.  Flags @option{-a} and
-
 
4384
@option{-o} are nowadays declared obsolescent by POSIX and should not be
-
 
4385
used.
4384
 
4386
 
-
 
4387
The @option{-o} flag for @command{set} in shell scripts is optional in
-
 
4388
POSIX and not supported on all the platforms @R{} is used on.
-
 
4389
 
4385
On macOS Catalina and later, which shell @file{/bin/sh} invokes is user-
4390
On macOS Catalina which shell @file{/bin/sh} invokes is user- and
4386
and platform-dependent: it might be @command{bash} version 3.2,
4391
platform-dependent: it might be @command{bash} version 3.2,
4387
@command{dash} or @command{zsh} (for new accounts it is @command{zsh},
4392
@command{dash} or @command{zsh} (for new accounts it is @command{zsh},
4388
for accounts ported from earlier version it is usually @command{bash}).
4393
for accounts ported from earlier version it is usually @command{bash}).
4389
 
4394
 
4390
@item
4395
@item
4391
Make use of the abilities of your compilers to check the
4396
Make use of the abilities of your compilers to check the