declare
Quick Reference
Command Name:
declare
Category:
file management
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
- 1
Variable typing
Declare variables with specific attributes and constraints in Bash
- 2
Array creation
Define and manage indexed and associative arrays in shell scripts
- 3
Function parameter handling
Create variables with specific behaviors for function inputs
- 4
Script debugging
Enable variable tracing and error detection in complex scripts
Syntax
declare [OPTION]... [FILE]...
Options
| Option | Description |
|---|---|
-l |
Use a long listing format |
-a |
Show hidden entries starting with . |
-h |
Human-readable sizes |
-R |
List subdirectories recursively |
Examples
How to Use These Examples
The examples below show common ways to use the declare command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.