From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27886 invoked from network); 8 Mar 2005 06:05:46 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 8 Mar 2005 06:05:46 -0000 Received: (qmail 62060 invoked from network); 8 Mar 2005 06:05:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Mar 2005 06:05:39 -0000 Received: (qmail 16150 invoked by alias); 8 Mar 2005 06:05:31 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8563 Received: (qmail 16135 invoked from network); 8 Mar 2005 06:05:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 8 Mar 2005 06:05:30 -0000 Received: (qmail 60994 invoked from network); 8 Mar 2005 06:05:30 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 8 Mar 2005 06:05:26 -0000 Received: from candle.brasslantern.com ([4.11.1.68]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0ID000HMORKZ6DO0@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Tue, 08 Mar 2005 00:05:24 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j2865MOu001837 for ; Mon, 07 Mar 2005 22:05:23 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j2865M8G001836 for zsh-users@sunsite.dk; Mon, 07 Mar 2005 22:05:22 -0800 Date: Tue, 08 Mar 2005 06:05:21 +0000 From: Bart Schaefer Subject: Re: Autoloaded bash shell scripts treated as zsh In-reply-to: To: zsh-users@sunsite.dk Message-id: <1050308060521.ZM1835@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: Comments: In reply to zzapper "Autoloaded bash shell scripts treated as zsh" (Mar 7, 11:41pm) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Mar 7, 11:41pm, zzapper wrote: } } autoload ${fpath[1]}/*(:t) #autoload all functions in $fpath Well, as you discovered, this actually means: "Assume the name of every file in $fpath is also the name of a zsh function, and create an autoload for every function so named." } As I also use the same directory for my legacy bash scripts, I was } unpleasantly surprised to find that these scripts had also been } autoloaded and were now being treated as zsh scripts. How (and why) did you expect zsh to tell the two sets of functions apart if you put them all in the same directories? There's no magic here; zsh doesn't examine the contents of the files for #! lines or anything like that -- for one thing, many functions don't have a #! line because they're not designed to be executed as standalone scripts. } Easy to fix, either I make the scripts zsh compatible or move them } elsewhere. A third possibility is to zcompile only the zsh functions, then use "autoload -w" to load them. } Q2) I was surprised to what extent my bash scripts worked as zsh } (mostly only required the adding of a pre-declaration of any } variables), is a reasonable proportion of bash available from within } zsh? Both bash and zsh are to a significant degree compatible with the POSIX shell standard, so yes, they have a lot of overlap, and if you don't use any of the special features of either shell, then the same scripts and functions should work in both.