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

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



On Jun 5,  9:39am, Peter Stephenson wrote:
} Subject: Re: sourcing of /etc/profile with $0 == -sh
}
} % fn() { 0=foo; echo $0; }  
} % fn
} foo
} % echo $0
} zsh
} 
} This fact should probably be construed as a genuine feature.  If you're
} asking, is some bright spark going to decide that $0 should be different
} from $1 to $infinity and break it, I can't answer that, but it won't be me.

Actually, Peter, you're already too late.  That had better be

	fn() {
	  setopt functionargzero
	  0=foo
	  echo $0
	}

Otherwise, assigning to 0 in the function assigns to the "global" $0.

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



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