Mryqu's Notes


  • 首页

  • 搜索
close

Shell中的source和.命令

时间: 2013-10-10   |   分类: Tool   Linux     |   阅读: 159 字 ~1分钟

source是csh(C Shell)的内置命令: 标识读入并执行文件中的命令。 这与执行shell脚本是不一样的./script.sh会启动一个新的shell并执行script.sh中的命令。

source [-h] filename [arguments]
  The  shell reads and executes commands from name.  The commands
  are not placed on the history list.  If  any  args  are  given,
  they are placed in argv.  (+) source commands may be nested; if
  they are nested too deeply  the  shell  may  run  out  of  file
  descriptors.   An error in a source at any level terminates all
  nested source commands.  With -h, commands are  placed  on  the
  history list instead of being executed, much like `history -L'.

sh (Bourne Shell)和ksh (Korn Shell)有一个类似的命令 .

. filename [arguments]
  The commands in the specified file are read and executed by the shell.
  The return command may be used to return to the . command's caller.
  If file contains any ''/'' characters, it is used as is.  Otherwise, the shell
  searches the PATH for the file.  If it is not found in the PATH, it is sought
  in the current working directory.

bash (GNU Bourne-AgainShell)是组合了sh/ksh/csh的特征同时支持(source)命令和.命令。

标题:Shell中的source和.命令
作者:mryqu
声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!

#nix# #shell# #source# #.命令# #command#
正则表达式风格与语法对比
获取Tomcat版本的简单办法
  • 文章目录
  • 站点概览

Programmer & Architect

662 日志
27 分类
1472 标签
GitHub Twitter FB Page
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%