#!/bin/bash if [ "$PROC_PID" != "$PPID" ]; then export PROC_PID=$$ var="mype" echo "initial $var" declare -r var export var $0 & # child process else echo "before $var" var="netty5" echo "after $var" fi
# Declaration of read-only Variable
$ readonly Z="Y"
$ echo $Z
Y
# Suppression test
$ unset Z
-l: unset: Z: cannot unset: readonly variable
# Replacement test
$ Z=W
-l: Z: readonly variable
# Declaration of an indirect variable
$ Y=W
$ echo "$Y"
W
# Development of variable with indirection
$ echo "${!Z}"
W
$Results for Modifying a read only variable
Results for Modifying a read only variable
Results for Modifying a read only variable
Results for Modifying a read only variable
Results for Modifying a read only variable
Results for Modifying a read only variable