----- Original Message -----
From: "Alaa The Great" <alaa@...>
To: "Bruce Burhans" <bburhan1@...>
Sent: Thursday, August 29, 2002 12:48 AM
Subject: Re: [Linuxcommand-discuss] Greetings & a Script
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On Wed, 28 Aug 2002 20:15:34 -0700
> "Bruce Burhans" <bburhan1@...> wrote:
> > > I modified it a bit to be handle filenames with spaces (they are
> > > not a good idea I know)
> > >
> > They are a drag...Linux doesn't know how to cope with them.....I
> > end up
> > having to do mv foo* and ls
> > divides the names into seperate filenames.....
> it copes with them fine if you know bash quoting rules, they are very
> complex however and I always have to try several combinations before I
> get it right.
I was referring to files transferred from that legacy
> > > #!/bin/bash
> > > old=$1
> > > new=$2
> > > for i in *$old;
> > > do
> > > echo mv \"$i\" \"`basename "$i" $old`$new\";
> > > done
> > >
> > this works without the $k part? Sure looks like it
> > would...... Will
> yes it works because of the back ticks which puts the output of
> basename in front of echo.
Yes, I caught that.......Bill says that backticks are
ugly and to use $( ). But more is involved : With a
poor editor like the one in OE, it is very hard to tell
whether they are forward or back quotes.....
> > have to try it....What if there IS no space....? If it works it
> > sure is efficient..........
> of course it works if there are no spaces, it handles any other
> special character except the double quote itself.
> > How do you pipe something on stdout to bash?
> sh foo | bash
> this pipes the output of the script foo to bash
> if foo is executable then simply
> foo | bash
> this is one of the things that no one tells you, bash reads from stdin
> like any other GNU command.
THAT is valuable information....And until now I had
no clue......It is hard to relate to bash as just another
> I use this technique all the time specially because of bad filenames,
> you can never be sure what your script is going to do.
> P.S. loved the fe script, it amazing how much you can achieve in few
> lines, maybe you should work on adding more options
Thanks. It would be nice to have one to run <file>
or <ls -lha> or <zless> instead of <less>......Needs a few
real registers (In RAM, which I don't know how to create Would you just
create a ramdisk?) for file operations like cp and mv.......
Here's a simple script I wrote so that I could have a running clock to set
my house clock....
while : do
# ^c to exit
> - --
> Perilous to all of us are the devices of an art deeper than we
> -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> -----END PGP SIGNATURE-----