[openstack-dev] [docs] About the convention to use '.' instead of 'source'.

Monty Taylor mordred at inaugust.com
Sun Feb 18 09:55:51 UTC 2018


On 02/17/2018 03:03 PM, Jeremy Stanley wrote:
> On 2018-02-17 13:47:02 -0500 (-0500), Hongbin Lu wrote:
> [...]
>> If anyone can clarify the rationals of this convention, it will be
>> really helpful.
> [...]
> 
> There's a trade-off here: while `.` is standardized in POSIX sh
> (under Utilities, Dot in the specification), it's easy to miss when
> reading documentation and/or cutting and pasting from examples. On
> the other hand, `source` is easier to see but was originally unique
> to csh (which lacks `.`) and subsequently borrowed by the bash shell
> environment as an alias for `.` ostensibly to ease migration for
> users of csh and its derivatives. The `source` command is not
> implemented by a number of other popular shells however, which may
> make it a poor interoperability choice (given csh is an arguably
> less popular shell these days) unless we assume a specific shell
> (e.g., bash).

I'd honestly argue in favor of assuming bash and using 'source' because 
it's more readable. We don't make allowances for alternate shells in our 
examples anyway.

I personally try to use 'source' vs . and $() vs. `` as aggressively as 
I can.

That said - I completely agree with fungi on the description of the 
tradeoffs of each direction, and I do think it's valuable to pick one 
for the docs.



More information about the OpenStack-dev mailing list