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

Re: loading user startup files for zsh scripts



On Feb 10, 11:30am, Greg Klanderman wrote:
}
} Unfortunately I cannot modify /etc/zshenv on the one to two hundred
} people's machines that are using our shared zsh startup files at work;
} I can suggest they modify ~/.zshenv but it's unlikely to be widely
} followed, which is why I was looking for a solution in the shared file
} sourced by ~/.zshenv, but it sounds like that just can't work.

Hmm.  Yeah, I tried examining things like $funcfiletrace etc. and they
don't provide any additional information.

I can suggest a draconian solution: make update more than a suggestion.

Change your shared file to have it require that $0 be passed as an
argument, e.g.

	source /the/shared/zshenv $0

This shows up as $1 in your shared file.  Have the file do NOTHING if
there is no $1, otherwise test $1 against $ZSH_NAME, etc.  Maybe if
the shell is interactive, print a warning.

That way your users are forced to update their ~/.zshenv if they want
to continue getting the benefit of your shared file.

If you want to be even MORE draconian, give them a week and then have
the file call exit if there is no $0, so their shells just plain die
until they fix it.  (Exclude login shells from that approach ...)

-- 



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