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

sourcing of /etc/profile with $0 == -sh



In my /etc/zprofile I source /etc/profile. Unfortunately, it contains code
depending of shell (that is, case $0 in -sh | -ksh ...). I don't want to
mess up with system /etc/profile, so I tried to find a way to set $0 only
for the time of sourcing. Currently I use (zsh-3.1.4):

function source_etc_profile () {
    local 0=-zh
    emulate -R sh
    setopt localoptions

    source /etc/profile
}

source_etc_profile

The questions is, how reliable is creating of local shadow of $0? I don't
want the next release to break this script

thank you

============================================================
Andrej Borsenkow                Fax:   +7 (095) 796 99 20
SNI ITS Moscow                  Tel:   +7 (095) 796 99 24

NERV:  borsenkow.msk            E-Mail: borsenkow.msk@xxxxxx
============================================================




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