Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the readonly command of linux to mark shell variables or functions as read-only

Shulou Source: shulou.com Published: 2022-06-02 13:49:09 10月26日 Update

This article mainly introduces the use of linux's readonly command to mark shell variables or functions as read-only, the article is very detailed, has a certain reference value, interested friends must read it!

The readonly command is mainly used to define one or more variables and set read-only properties, set read-only properties for one or more defined variables, display all variables that contain read-only attributes, set read-only properties for one or more functions that have been defined, and display all functions that contain read-only attributes.

Syntax format: readonly [parameters]

Common parameters:

Reference example

Show all read-only variables:

[root@linuxcool ~] # readonly

Displays all arrays with read-only attributes:

[root@linuxcool] # readonly-a

Displays all associative arrays with read-only attributes:

[root@linuxcool] # readonly-A

Displays all functions that have read-only properties:

[root@linuxcool] # readonly-f

The option after it is not valid:

[root@linuxcool ~] # readonly-these are all things that use linux's readonly command to mark shell variables or functions as read-only. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Attributes variables functions commands multiple tags content parameters arrays references values interests examples guys buddies commonly used more formats knowledge articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MySQL Shulou Technology vpn Apple