[CLUE-Tech] The cp command

John H Swaby polymath at uwyo.edu
Sat Apr 21 01:37:24 MDT 2001


On Sat, 14 Apr 2001, Kevin Cullis wrote:
> Brandon, Thanks for the script.  I'll try it out.
> 
> Brandon N wrote:
> > here is the script, i called it cpr  (copy recursively)
> >
> > #!/bin/bash
> > for directory in `ls -d */`;
> > do
> >     cp $1 $directory
> > done
> > 
> > then just do
> > cpr file

No need for a script.  This will work just fine:

  ls -d */ | sed 's/^/cp myfile /' | sh

To understand the above you need to be aware that, unlike most Unix
utilities, ls is not always WYSIWYG.

ls [-d], on its own, will present its output in multiple columns.
But piped or redirected, its output is a single column.

IMHO the CLI cannot be beat for flexibility and power.
The GUI interface may be "easy"; but it is limited and weak.

John Swaby

-------------

There is no point in comparing vi and EMACS:  vi is just
an editor; whereas, EMACS just happens to have an editor.

  E xtensible
  M odifiable
  A lgorithmic
  C omputer
  S ystem





More information about the clue-tech mailing list