bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Claim `declare' as a special command in manual?


From: Clark Wang
Subject: Claim `declare' as a special command in manual?
Date: Wed, 8 Nov 2017 12:20:23 +0800

For now the `declare' command is under SHELL BUILTIN COMMANDS in the man
page so people may think bash parses the command line parameters the same
way as other built-in commands which is not true.

  [STEP 100] # echo $BASH_VERSION
  4.4.12(4)-release
  [STEP 101] # declare -a arr=()
  [STEP 102] # echo declare -a arr=()
  bash: syntax error near unexpected token `('
  [STEP 103] #

It seems to me bash internally parses the `declare' command specially and
(logically) convert `declare -a arr=()' to two statements `declare -a arr'
and `arr=()'.

So does it make sense to move `declare' out of the SHELL BUILTIN COMMANDS
and put it in a separate section? Or at least explicitly state that
`declare' is special?

-clark


reply via email to

[Prev in Thread] Current Thread [Next in Thread]