The Shell provides a way to mark variables as read-only by using the readonly command. After a variable is marked readonly, its value cannot be changed.
For example, the following script generates an error while trying to change the value of the bike variable:
#!/bin/bash bike="Ducati Desmosedici" readonly bike echo $bike bike="Yamaha M1" echo $bike
ro.sh: line 6: bike: readonly variable