Shell read-only variable

test.sh:

#!/bin/bash

myUrl
="http://www.google.com span>"
readonly myUrl
myUrl
="http://www.runoob.com span>"

Output

bogon:Desktop macname $ ./test.sh

.
/test.sh: line 4: myUrl: readonly span> variable

Reference:

https://www.runoob.com/linux/linux-shell-variable.html< /p>

#!/bin/bash

myUrl
="http://www.google.com span>"
readonly myUrl
myUrl
="http://www.runoob.com span>"

bogon:Desktop macname$ ./test.sh

.
/test.sh: line 4: myUrl: readonly span> variable

Leave a Comment

Your email address will not be published.