Re: Call for input on comp.unix.shell FAQ

From: Faux_Pseudo (Faux_Pseudo_at_yahoo.comERCIAL)
Date: 07/17/03


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


Relevant Pages

  • Re: Python or PHP?
    ... > every language here and there more ways to do something. ... The best the programmer can do, as you imply, is to ... parse out into proper perl expressions. ... > lists, dictionaries, etc. etc. ...
    (comp.lang.python)
  • Re: Native language versions
    ... It is a different language which can be translated ... into perl and can use Perl modules. ... away quite a bit from the OP's notion of just translating perl keywords ... There's probably not much use for a user-accessible programming language ...
    (comp.lang.perl.misc)
  • Re: Wondering if you guys would like to comment on this
    ... >>ever tried using someone's highly customized EMACS setup? ... I've had the same experience with perl that he ... problem with any programming language, perl tends to make it worse ... I have the same rules on LISP programming that I do with perl ...
    (comp.lang.lisp)
  • Recommend an E-book Meeting the Following Criteria (Newbie, Long)
    ... I know several programming languages namely Java, Perl and C in this order ... Now I'm wondering which Python book I should get as there are so many out ... I'd like to mostly concentrate on language features but some pointers ...
    (comp.lang.python)
  • Re: Why I never got into Lisp
    ... solutions in languages like Perl. ... and what you tried in Lisp, and how Lisp mapped better, for you. ... While this can be done to some extent in any language, ... liked the fact that Ruby, like lisp, seems to have sensible defaults ...
    (comp.lang.lisp)