source filename [arguments]
Read and execute commands from filename in the current shell
environment and return the exit status of the last command exe-
cuted from filename. If filename does not contain a slash, file
names in PATH are used to find the directory containing file-
name. The file searched for in PATH need not be executable.
When bash is not in posix mode, the current directory is
searched if no file is found in PATH. If the sourcepath option
to the shopt builtin command is turned off, the PATH is not
searched. If any arguments are supplied, they become the posi-
tional parameters when filename is executed. Otherwise the
positional parameters are unchanged. The return status is the
status of the last command exited within the script (0 if no
commands are executed), and false if filename is not found or
cannot be read.
zhaoyuzhong3694 于 2010-03-18 13:44:41发表:
1、#!/bin/bash这是命令解释器或者是命令的绝对路径
比如
#!/bin/csh
#!/bin/tcsh
#!/bin/ksh
这是命令解释器,也就是shell。
表示脚本的内容用这行标明的shell来解释成计算机可识别的语言。
还有这种用法:
#!/bin/rm
这个就是命令了,你可以试试,这会生成一个自删除脚本。
2、source这个是unix种的命令,与bash,csh,ksh无关,只是编写的脚本中的一条命令。
njliuqi 于 2010-03-18 09:30:37发表:
source filename [arguments]
Read and execute commands from filename in the current shell
environment and return the exit status of the last command exe-
cuted from filename. If filename does not contain a slash, file
names in PATH are used to find the directory containing file-
name. The file searched for in PATH need not be executable.
When bash is not in posix mode, the current directory is
searched if no file is found in PATH. If the sourcepath option
to the shopt builtin command is turned off, the PATH is not
searched. If any arguments are supplied, they become the posi-
tional parameters when filename is executed. Otherwise the
positional parameters are unchanged. The return status is the
status of the last command exited within the script (0 if no
commands are executed), and false if filename is not found or
cannot be read.
Royou 于 2010-03-18 08:40:37发表:
1、程序头上的 #!/bin/bash 什么作用?
表示这是一个可执行的shell文件,后面的/bin/bash用于指定shell脚本解析时用的是bash解析器
每二问题没有用过,等待结果.
xzj4167 于 2010-03-18 07:23:25发表:
网上搜一下吧