- 论坛徽章:
- 8
|
这也就是为什么ps不能找到正在运行的脚本的名字的原因了。
或许有另一种解释
如果找不到,不妨在脚本上加入 #!试试
这个可以从manpage中找到解释
If this execution fails because the file is not in executable format,
and the file is not a directory, it is assumed to be a shell script, a
file containing shell commands. A subshell is spawned to execute it.
This subshell reinitializes itself, so that the effect is as if a new
shell had been invoked to handle the script, with the exception that
the locations of commands remembered by the parent (see hash below
under SHELL BUILTIN COMMANDS) are retained by the child.
If the program is a file beginning with #!, the remainder of the first
line specifies an interpreter for the program. The shell executes the
specified interpreter on operating systems that do not handle this
executable format themselves. The arguments to the interpreter con-
sist of a single optional argument following the interpreter name on
the first line of the program, followed by the name of the program,
followed by the command arguments, if any. |
|