Bug 8376 - ash: add support for `declare`
Summary: ash: add support for `declare`
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.24.x
Hardware: PC All
: P5 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-28 18:43 UTC by Jim
Modified: 2016-02-13 11:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim 2015-09-28 18:43:11 UTC
declare

Declare variables and give them attributes.

SYNTAX
      declare [-afFrxi] [-p] [name[=value]]

OPTIONS

      -a  Each name is an array variable.

      -f   Use function names only.

      -F   Inhibit the display of function definitions; 
           only the function name and attributes are printed. 
           (implies -f)

      -i   The variable is to be treated as an integer; 
           arithmetic evaluation is performed when the 
           variable is assigned a value.

      -p   Display the attributes and values of each name. 
           When `-p' is used, additional options are ignored.

      -r   Make names readonly. These names cannot then
           be assigned values by subsequent assignment statements 
           or unset.

      -x   Mark each name for export to subsequent commands
           via the environment.

If no names are given, then `declare' will display the values of variables instead.

Using + instead of - turns off the attribute instead.

When used in a function, declare makes each name local, as with the local command.

The typeset command is supplied for compatibility with the Korn shell; however, it has been deprecated in favor of the declare builtin command.

The return status is zero unless an invalid option is encountered, an attempt is made to define a function using `-f foo=bar', an attempt is made to assign a value to a readonly variable, an attempt is made to assign a value to an array variable without using the compound assignment syntax, one of the names is not a valid shell variable name, an attempt is made to turn off readonly status for a readonly variable, an attempt is made to turn off array status for an array variable, or an attempt is made to display a non-existent function with `-f'.