From 768f6203d25be46fc3040f80b38d3eed268046a2 Mon Sep 17 00:00:00 2001 From: parthzz Date: Mon, 2 Oct 2023 10:24:14 +0530 Subject: [PATCH] readonly: add page (#10786) * readonly: add page * Update readonly.md * Update readonly.md * Update pages/common/readonly.md Co-authored-by: Reinhart Previano Koentjoro * Update readonly.md * Update pages/common/readonly.md Co-authored-by: Jack Lin * Update pages/common/readonly.md * Update pages/common/readonly.md * Update pages/common/readonly.md --------- Co-authored-by: Reinhart Previano Koentjoro Co-authored-by: Jack Lin --- pages/common/readonly.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pages/common/readonly.md diff --git a/pages/common/readonly.md b/pages/common/readonly.md new file mode 100644 index 000000000..d6aa2722a --- /dev/null +++ b/pages/common/readonly.md @@ -0,0 +1,17 @@ +# readonly + +> Create or modify read-only variables within a shell script, preventing the variable from being changed by subsequent commands. +> This is useful when you want to ensure that a variable retains a constant value throughout the execution of a script. +> More information: . + +- Create a read-only variable: + +`readonly {{variable_name}}={{value}}` + +- Mark a variable as read-only: + +`readonly {{existing_variable}}` + +- [p]rint to the standard output the names and values of all read-only variables: + +`readonly -p`