What happens when I execute a unix shell script using a '.' command?

坚强是说给别人听的谎言 提交于 2019-12-12 12:31:30

问题


For e.g., when I say ". .bashrc" on my linux command prompt, is there a corresponding binary/script that gets executed in place of the first dot? If the dot itself is a command, where is its location?


回答1:


The . operator is shorthand for the source Bash builtin (as pointed out by John Kugelman below). Typing

help .

or

help source

at the Bash prompt will give you some information. For more on how source works, see http://www.ss64.com/bash/period.html.




回答2:


Additionally I want to point out that you don't "execute" anything with it (in terms of fork/exec), which is very important (and probably the only reason '.' exists).



来源:https://stackoverflow.com/questions/1107808/what-happens-when-i-execute-a-unix-shell-script-using-a-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!