[Git-commits] [grml/grml-etc-core] fbdbd8: fix usage of 'typeset -U'

Thilo Six grml at xk2c.de
Sun Feb 5 13:43:07 CET 2017


  Branch: refs/heads/master
  Home:   https://github.com/grml/grml-etc-core
  Commit: fbdbd827671eb277487c32c25f32da11dbf408bb
      https://github.com/grml/grml-etc-core/commit/fbdbd827671eb277487c32c25f32da11dbf408bb
  Author: Thilo Six <grml at xk2c.de>
  Date:   2017-02-05 (Sun, 05 Feb 2017)

  Changed paths:
    M etc/zsh/zshrc

  Log Message:
  -----------
  fix usage of 'typeset -U'

>From man zsh:
for variables with shared values  it is  therefore  recommended to set the flag
for all interfaces, e.g. `typeset -U PATH path'.

Otherwise one of them is not unique:
% echo ${parameters[path]}
array-unique-special
% echo ${parameters[PATH]}
scalar-export-special

After:
% echo ${parameters[path]}
array-unique-special
% echo ${parameters[PATH]}
scalar-export-unique-special

Additionally drop a superflous for loop.


  Commit: 57c97bc2ef1484c7aaaa7e96d28da6371cd7fbb8
      https://github.com/grml/grml-etc-core/commit/57c97bc2ef1484c7aaaa7e96d28da6371cd7fbb8
  Author: Thilo Six <grml at xk2c.de>
  Date:   2017-02-05 (Sun, 05 Feb 2017)

  Changed paths:
    M etc/zsh/zshrc

  Log Message:
  -----------
  use function keyword through out the code

>From man zsh:
-----------------------------------------------------------------------
Note also the unhelpful interaction of  aliases  and  function  defini‐
tions:

	alias func='noglob func'
	func() {
	    echo Do something with $*
	}

Because  aliases  are expanded in function definitions, this causes the
following command to be executed:

	noglob func() {
	    echo Do something with $*
	}

which defines noglob as well as func as functions with the body  given.
To  avoid this, either quote the name func or use the alternative func‐
tion definition form `function func'.
-----------------------------------------------------------------------

Therefore make use of the function keyword through out the code for
defining shell functions. Also harmonize its usage, where it is used allready.


Compare: https://github.com/grml/grml-etc-core/compare/cedfc98d894d...57c97bc2ef14


More information about the Git-commits mailing list