unix command line execute with . (dot) vs. without

后端 未结 5 561
失恋的感觉
失恋的感觉 2020-12-02 20:57

At a unix command line, what\'s the difference between executing a program by simply typing it\'s name, vs. executing a program by typing a . (dot) followed by the program n

5条回答
  •  时光说笑
    2020-12-02 21:32

    Using "source" or "." causes the commands to run in the current process. Running the script as an executable gives it its own process.

    This matters most if you are trying to set environment variable in current shell (which you can't do in a separate process) or want to abort the script without aborting your shell (which you can only do in a separate process).

提交回复
热议问题