bash-hackers-wiki/docs/commands/builtin/readonly.md
Hanson Char b75c3a588b Fix hyperlinks of markdown pages at depth 3
find docs/ -depth 3  -name '*.md' | xargs grep '(.*/' -l | \
  xargs -I{} \
  sed -i '' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)\(.md\)\{0\})%(../../\1/\2.md)%g' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)#\([a-zA-Z_-][0-9a-zA-Z_-]*\))%(../../\1/\2.md#\3)%g' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)\(.md\)\{0\})%(../../\1/\2/\3.md)%g' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)#\([a-zA-Z_-][0-9a-zA-Z_-]*\))%(../../\1/\2/\3.md#\4)%g' \
  -e 's%](\([^:.>)#][^:.>)#]*\))%](../../\1.md)%g' \
  -e 's%](\([^:.>)#][^:.>)#]*\)#\([^:.>)#][^:.>)#]*\))%](../../\1.md#\2)%g' \
  {}

Related to https://github.com/flokoe/bash-hackers-wiki/issues/10
2024-01-28 17:26:57 -08:00

1.3 KiB

The readonly builtin command

Synopsis

readonly [-p] [-a] [-A] [-f] [NAME[=VALUE] ...]

Description

The readonly builtin command is used to mark variables or functions as read-only, which means unchangeable. This implies that it can't be unset anymore. A readonly variable may not be redefined in child scopes. A readonly global may not be redefined as a function local variable. Simple command environment assignments may not reference readonly variables.

Options

Option Description


-a refer to normal arrays -A refer to associative arrays -f refer to functions -p print all read-only variables or functions, -a, -A and -f can be used to filter. The output is reusable as input

An argument of -- disables further option processing.

Return status

Status Reason


0 no error !=0 invalid option !=0 invalid combination of options !=0 a given NAME is invalid

Examples

Portability considerations

  • in POSIX(r), only the -p option is specified

See also