Session and utilities
The declare command
Declares or shows variables (and arrays) with their attributes.
Syntax
declare [opciones] [nombre=valor]Most useful options
-aCreates an array-iIntegers only-pShows the variableCopy-ready examples
$ declare COLOR=azulCreate a variable$ echo ${COLOR}Read itYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- local (inside functions) and declare (global) are similar.
FAQ
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course