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

RE: copying files with shell built in functions?



> In a fit of mental derangement, my colleagues tried to exchange
> the libc on a machine at run time and used 'mv' to rename the
> file.  As you might imagine, they regretted that immediately :-)
> 
> Can anyone think of a way to copy or rename a file with only shell
> built in functions?  (either zsh or bash)  I have tried things
> like
> 
>   $ while read <options> X; do echo <options> "$X"; done < ifile > ofile
> 
> and
> 
>   $ echo $(< ifile) > ofile
> 
> (does not work because echo destroys XR and LF)
> 
> or
> 
>   $ cat <<EOF > ofile
>   $(< ifile)
>   EOF
> 
> (does not work because it still needs a cat and the here document
> is mangled.
> 

bor@itsrm2% zmodload zsh/files
bor@itsrm2% which mv
mv: shell built-in command
bor@itsrm2% which rm
rm: shell built-in command
bor@itsrm2% man zshmodules
bor@itsrm2% echo $ZSH_VERSION
4.0.4

-andrey



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