1 |
On Mon, Jun 20, 2011 at 08:39:00PM +1000, Adam Carter wrote: |
2 |
> >> /bin/sh is a symlink to bash. |
3 |
> > |
4 |
> > Which runs as sh when run from the symlink. |
5 |
> |
6 |
> I dont understand. "runs as" usually means "runs under the user |
7 |
> context" to me - are you saying bash has an sh compatibility mode? |
8 |
|
9 |
|
10 |
Yes, from the bash man page: |
11 |
|
12 |
If bash is invoked with the name sh, it tries to mimic the startup |
13 |
behavior of historical versions of sh as closely as possible, while |
14 |
conforming to the POSIX standard as well. When invoked as an interac‐ |
15 |
tive login shell, or a non-interactive shell with the --login option, |
16 |
it first attempts to read and execute commands from /etc/profile and |
17 |
~/.profile, in that order. The --noprofile option may be used to |
18 |
inhibit this behavior. When invoked as an interactive shell with the |
19 |
name sh, bash looks for the variable ENV, expands its value if it is |
20 |
defined, and uses the expanded value as the name of a file to read and |
21 |
execute. Since a shell invoked as sh does not attempt to read and exe‐ |
22 |
cute commands from any other startup files, the --rcfile option has no |
23 |
effect. A non-interactive shell invoked with the name sh does not |
24 |
attempt to read any other startup files. When invoked as sh, bash |
25 |
enters posix mode after the startup files are read. |
26 |
|
27 |
W |
28 |
-- |
29 |
Willie W. Wong wwong@××××××××××××××.edu |
30 |
Data aequatione quotcunque fluentes quantitae involvente fluxiones invenire |
31 |
et vice versa ~~~ I. Newton |