declare -r CONST=value

Category: Shell & Bash

declare -r CONST=value

Declare a read-only (constant) variable

Creates a read-only variable that cannot be changed or unset — like a constant. -r means 'readonly'.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.