Running scripts
When any program is executed, the UnixWare 7 kernel looks at the first
two characters of the file (the ``magic number'' header) to determine if
it is a binary or a script. If the first two characters are #!, it is
a script (shell, TCL, Perl, AWK or other script) that needs to be
interperted by another program.
The kernel then determines the absolute path of the script.
From UNIX mode:
-
If the absolute path of the script begins with /linux, it
changes root (see
chroot(2))
to the /linux directory and
executes the appropriate
Linux interperter (determined from the first line of the script).
-
Otherwise, it executes the appropriate UnixWare 7 interperter.
From Linux mode:
-
If the absolute path of the script begins with /unixware
it changes root to the /unixware directory and
it executes the appropriate UnixWare 7 interperter.
-
Otherwise, it executes the appropriate Linux interperter.
These rules work well in most cases, but confusion can be caused by the
following situations:
-
If a Linux Bash shell script resides in /unixware,
the system assumes it is a UnixWare 7 Bourne script, and it will not
run properly.
UnixWare 7 Bourne scripts residing under /linux encounter
the opposite problem; they are assumed to be Bash scripts,
and fail when the system attempts to run them as such.
Scripts should be kept in the environments for which they are intended.
-
The system detects scripts by the first two characters (#!).
If you are working with a script that does not begin with #!, results are
unpredictable.
Previous topic:
Running application binaries
© 2002 Caldera International, Inc. All rights reserved.
UnixWare 7 Release 7.1.3 - 17 October 2002