Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: copying files with shell built in functions?
- X-seq: zsh-users 5993
- From: Stephane CHAZELAS <Stephane_CHAZELAS@xxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: copying files with shell built in functions?
- Date: Fri, 28 Mar 2003 18:46:09 +0100
- In-reply-to: <20030328165928.GB14934@xxxxxx>; from dominik.vogt@xxxxxx on Fri, Mar 28, 2003 at 05:59:29PM +0100
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20030328165928.GB14934@xxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author