Open In App

declare command in Linux with Examples

The declare is a builtin command of the bash shell. It is used to declare shell variables and functions, set their attributes and display their values.

Syntax:



declare [-a] [-f] [-g] [-F] [-x] [-p] [name[=value]] [name[=value]] …

Example: In this example we will declare a variable using declare command.



The output of the above typed commands is as follow:

Options:

Note: For more details, you can use –help option with “declare” command as follows:

Article Tags :