Re: Call for input on comp.unix.shell FAQ
From: Faux_Pseudo (Faux_Pseudo_at_yahoo.comERCIAL)
Date: 07/17/03
- Next message: Glenn Morris: "bash: immediate expansion in a function definition"
- Previous message: Stephane CHAZELAS: "Re: Call for input on comp.unix.shell FAQ"
- In reply to: Stephane CHAZELAS: "Re: Call for input on comp.unix.shell FAQ"
- Next in thread: Kevin Rodgers: "Re: Call for input on comp.unix.shell FAQ"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 16 Jul 2003 23:37:39 GMT
_.--- Stephane CHAZELAS spoke in comp.unix.shell --------._
>>>>> 31 how do I rename *.foo to *.bar?
>
>> OLD=foo
>> NEW=bar
>> for f in *$OLD ; do
>> mv $f ${f%.*}.$NEW
>> done
>
> Why do you insist in leaving variables unquoted?
Because I am a bad bad boy. When I am doing actuall work I make a
point of quoting everying at least in ${X} or "$X" and sometimes in
both depending on the types of data that are going to end up in there.
> for f in ./*"$OLD"; do
> ls -d -- "$f" || continue
> mv "$f" "${f%."$OLD"}.$NEW"
> done
> for a POSIX shell, and it doesn't handle dot files.
If they want to handle dot files they can read the questions about dot
files. If every eventuallity is cramed into every example then we end
up with answers that will go over the heads of the readers and they
will learn nothing. And they will keep coming back for the basics.
>> So please tell us the best way to fix that as well.
>
> Use zsh instead.
Most people start scripting in the language which they use on a daily
bases. asking them to learn the details of a new language, no matter
how close to the one they already know, isn't a good solution. If
that was the case then we could just put a "Closed" sign on the group
and redirect everyone to learn a language like perl which will do
everything they want to do. If it weren't for the fact that
everything I have ever needed[0] can be done in bash I would be using
perl by now. I have already read Learning Perl 2 times now and still
haven't written one single script in it.
> "==" is not a standard test operator.
Nothing is standerd. Ever. As I said my answers are GNUcenteric.
'---...____ Faux_Pseudo ________________...---~~~
-- ICQ=66618055 : http://asciipr0n.com/fp UPDATED=05/06 YIM=faux_pseudo : Rev: he_cure/staring_at_the_sea/a_night_like_this.mp3 Drunken Kariokie : Now: dio-/cure_-_greatest_hits_(studio)_-_13_high.mp3 is one word : Fwd: 2/portishead/dummy/3_-_strangers.mp3
- Next message: Glenn Morris: "bash: immediate expansion in a function definition"
- Previous message: Stephane CHAZELAS: "Re: Call for input on comp.unix.shell FAQ"
- In reply to: Stephane CHAZELAS: "Re: Call for input on comp.unix.shell FAQ"
- Next in thread: Kevin Rodgers: "Re: Call for input on comp.unix.shell FAQ"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|