Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Read-only special variables and "local +h"



Try running the following function.

blam() {
    setopt localoptions extendedglob
    zmodload -i zsh/parameter
    set $(typeset +r)
    while (( $# )); do
        [[ $1 = [[:alnum:]]# ]] && {
	    print -n "assigning to local $1\: "
            eval \( local +h $1 \; ${(qf)$(set | grep \^$1=)} \)
	    case $? in
	    0) print no error detected;;
	    136) print floating point exception;;
	    139) print segmentation fault;;
	    *) print other failure;;
            esac
        }
        shift
    done
}

I get:

assigning to local ARGC: segmentation fault
assigning to local ERRNO: segmentation fault
assigning to local LINENO: segmentation fault
assigning to local PPID: segmentation fault
assigning to local TTYIDLE: segmentation fault
assigning to local builtins: floating point exception
assigning to local funcstack: no error detected
assigning to local history: floating point exception
assigning to local historywords: no error detected
assigning to local jobdirs: no error detected
assigning to local jobstates: no error detected
assigning to local jobtexts: no error detected
assigning to local modules: floating point exception
assigning to local parameters: floating point exception
assigning to local reswords: no error detected
assigning to local status: no error detected
assigning to local userdirs: floating point exception

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author