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

Re: possible to disable zsh compatibility mode?

On Aug 11,  5:47pm, Paul Lew wrote:
} Subject: possible to disable zsh compatibility mode?
} Is it possible to disable the sh/ksh compatibility mode in zsh?

There's presently no way (without modifying the source yourself) to build
zsh with argv[0]-based emulation turned off.  Perhaps there should be?

} My OS (Digital UNIX) script program fork the shell as:
} 	 execl(shell, "sh", "-is", 0);

Ick.  Your best bet is to use the ENV environment variable, e.g.

	ENV=$HOME/.zshzsh script zsh

Where the file ~/.zshzsh contains

	emulate -R zsh
	function source_etc {
	  [[ -r /etc/$1 ]] && source /etc/$1
	  unsetopt localoptions
	function sourcehome {
	  [[ -r ${ZDOTDIR:-$HOME}/$1 ]] && source ${ZDOTDIR:-$HOME}/$1
	  unsetopt localoptions
	source_etc zshenv
	[[ -o rcs ]] && {
	  sourcehome .zshenv
	  [[ -o login ]] && {
	    source_etc zprofile
	    sourcehome .zprofile
	  [[ -o interact ]] && {
	    source_etc zshrc
	    sourcehome .zshrc
	  [[ -o login ]] && {
	    source_etc zlogin
	    sourcehome .zlogin
	unfunction source_etc sourcehome

Zsh sources the file named by $ENV when emulating sh or ksh, and the above
commands are equivalent to what zsh executes internally when not emulating.

The remaining problem is that zsh still interprets its command-line flags in
emulation mode, but there's nothing that can be done about that.  The only
differences are in pretty obscure usages anyway.  Oh, and you can't stop it
from sourcing /etc/profile, which could alter ENV and thereby mess you up,
but it doesn't sound like you're having problems with that.

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

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