zsh-users
 help / color / mirror / code / Atom feed
From: Stephane CHAZELAS <Stephane_CHAZELAS@yahoo.fr>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: copying files with shell built in functions?
Date: Fri, 28 Mar 2003 18:46:09 +0100	[thread overview]
Message-ID: <20030328184608.D116@pcchazelas.free.fr> (raw)
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 <options> X; do echo <options> "$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


  parent reply	other threads:[~2003-03-28 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-28 16:59 Dominik Vogt
2003-03-28 17:30 ` Borzenkov Andrey
2003-03-28 17:46 ` Stephane CHAZELAS [this message]
2003-03-28 18:00 ` Zefram
2003-03-28 19:03   ` Bart Schaefer
2003-03-28 19:11     ` Stephane CHAZELAS
2003-03-29  3:46       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030328184608.D116@pcchazelas.free.fr \
    --to=stephane_chazelas@yahoo.fr \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).