bash . dot using

. (source or dot operator)

Read and execute commands from the filename argument in the current shell context.

Syntax
      . filename [arguments]

      source filename [arguments]

When a script is run using source it runs within the existing shell, any variables created or modified by the script will remain available after the script completes. In contrast if the script is run just as filename, then a separate subshell (with a completely separate set of variables) would be spawned to run the script.

There is a subtle difference between executing a script by running .ss64script (dot ss64script) and . ss64script (dot space ss64script)
the first is running a file thats been hidden from the 'ls' command, (although ls -a will show hidden files) the second option will execute ss64script even if it has not been set as an executable with chmod.

Unless you provide an exact path to filename then bash will look first via the PATH variable and then in the current directory (only if filename is not found in $PATH.) If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged.

When a script is run using `source' it runs within the existing shell, any variables created or modified by the script will remain available after the script completes.

If a script is run just as ss64script, then a separate subshell (with a separate set of variables) will be spawned to run the script.

Other ways that the bash shell can interpret a dot/period:
A dot can represent the current directory ("./filename")
In a regular expression, "." will match any single character, (not zero or more characters.)

A dot/period '.' is a synonym for 'source'

source is a bourne shell builtin and a POSIX `special' builtin

The return status is the exit status of the last command executed, or zero if no commands are executed. If filename is not found, or cannot be read, the return status is non-zero.

"Although the world is full of suffering, it is also full of the overcoming of it" ~ Helen Keller

转载于:https://my.oschina.net/u/2308739/blog/742935

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值