From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9683 invoked from network); 28 Mar 2003 17:56:01 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 28 Mar 2003 17:56:01 -0000 Received: (qmail 5192 invoked by alias); 28 Mar 2003 17:54:56 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5993 Received: (qmail 5181 invoked from network); 28 Mar 2003 17:54:56 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 28 Mar 2003 17:54:56 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [213.228.0.176] by sunsite.dk (MessageWall 1.0.8) with SMTP; 28 Mar 2003 17:54:56 -0000 Received: from pcchazelas.free.fr (grenoble-1-a7-62-147-73-228.dial.proxad.net [62.147.73.228]) by postfix4-2.free.fr (Postfix) with ESMTP id DDB4FD259 for ; Fri, 28 Mar 2003 18:54:54 +0100 (CET) Received: (from chazelas@localhost) by pcchazelas.free.fr (8.9.3/8.9.3) id SAA07689 for zsh-users@sunsite.dk; Fri, 28 Mar 2003 18:46:09 +0100 Date: Fri, 28 Mar 2003 18:46:09 +0100 From: Stephane CHAZELAS To: Zsh Users Subject: Re: copying files with shell built in functions? Message-ID: <20030328184608.D116@pcchazelas.free.fr> Mail-Followup-To: Zsh Users References: <20030328165928.GB14934@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.3.14i In-Reply-To: <20030328165928.GB14934@gmx.de>; from dominik.vogt@gmx.de on Fri, Mar 28, 2003 at 05:59:29PM +0100 On Fri, Mar 28, 2003 at 05:59:29PM +0100, Dominik Vogt wrote: [...] > $ while read X; do echo "$X"; done < ifile > ofile > > and > > $ echo $(< ifile) > ofile bash can't handle '\0', so forget it. If you have zsh 4, you probably have a mapfile module. zmodload zsh/mapfile print -rn -- $mapfile[ifile] > ofile Also note the zsh/files modules which provides builtin ln/mv/chown... If you don't have modules (or can't load them anymore because your libc is gone), you should still be able to do : while IFS= read -r line; do print -r -- $line done < ifile > ofile You'll probably end-up with a trailing \n, but that shouldn't harm. But I'm surprises you don't have at least one statically linked ln or mv somewhere. Here, I have a statically linked /sbin/zsh with mapfile and files built in. That can reveal useful. Also note the "vared mapfile[somefile]" for a text editor. -- Stéphane