Hello again,

I was playing around with ksh array syntax and its behaviour when set as read-only. In my testing I noticed that ksh will allow you to overwrite the first element of a read-only array. Example snippet:

#!/bin/ksh
arr[0]=val1
arr[1]=val2
readonly arr
echo "${arr[@]}"
arr=yikes
echo "${arr[@]}"

I tested a few other shells, and this bug does exists in the original pdksh and is also present in zsh. This bug is not present in ksh93, mksh or bash, where they abort when trying to modify the read-only array.

I don't have access to a proper ksh88 shell, but it would be nice if someone could confirm its behaviour.

I was just hoping someone could confirm if this is intended behaviour, or if it's a bug.

Regards,

Jordan

Reply via email to