bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: automation


From: Arne Babenhauserheide
Subject: Re: OT: automation
Date: Wed, 4 Nov 2009 21:54:29 +0100
User-agent: KMail/1.12.2 (Linux/2.6.30-gentoo-r5; KDE/4.3.2; x86_64; ; )

Am Sonntag, 1. November 2009 11:54:28 schrieb address@hidden:
> Another variant is zmv, which is part of zsh. I comes with its whole own
> language for specifying non-trivial filename patterns... Which is just
> idiocy. People would be much better off spending the time on learning
> generic for and sed instead, which comes in handy in other situations as
> well, instead of a single-purpose language only for this.

At least I know now what people mean with "powerful zsh" :) 

But for that I have Python, which I can also use to write most kinds of 
programs :) 

> > What I use of my shell is for loops, some globbing, pipes with sed,
> > grep, find, and such.
> 
> Yeah, these are exactly the generic tools I mean.

Oh, ok - I though you meant more esoteric stuff :) 

They came slowly, though - one little trick at a time. 

> So you want:
> 
>    find -type f -print0|xargs -0 -L 1 echo sed -i 's/orig/new/'

-L is what I searched for hours - many times now - but I never knew exactly 
how to search for it... 

It saves me from 
find | sed s/^/\"/ | sed s/$/\"/ | xargs 

(and some more evil constructs...)

Many thanks! 

> Where does escaping come in here at all?... (Unless you mean the actual
> sed script, which is usually a constant string, and it's generally a
> good idea to put it in single quotes -- I never even considered leaving
> these out...)

I mean stuff like this: 

        sed 's/blah\\\\/blubb/blau/'

(I didn't know that I can just enclose the whole 's///' in quotes - but now 
that I see it, it's clear - it's just an argument)
 
> Of course there are other situations where escaping is indeed necessary.
> However, most of the time it boils down to learning to use "$i" instead
> of bare $i:
> 
>    for i in *; do mv "$i" `<<<"$i" sed 's/\.JPG$/\.jpeg$/'`; done
> 
> I agree though that quoting is the single most problematic issue in
> shell scripting.

What do the <<< do in there? 

> Of course you can teach a writer to use text files, because text files
> are more powerful -- but they are only more powerful if you also teach
> him the stuff which can actually deal better with text files... Which is
> shell scripting.

And version tracking and website creation. 

That's one thing I had to manage for my free roleplaying system. Get every 
contributor to write txt or at least rtf but not Open Document files, which are 
terrible to version (why did they have to split the data into several files 
when they use XML anyway?). 
 
> > It's far less versatile than the shell, but it does what he needs and
> > he doesn't have to spend as much time learning things he won't really
> > need (improving ones writing skills takes enough learning time).
> 
> I don't buy this kind of arguments. Most people nowadays spend *a lot*
> of their time working with computers: many hours a day. And every
> regular computer user will need to do some less common stuff now and
> then. Some shell scripting skills will always pay off.

Most computer users nowadays never enter a shell - and never means never, 
because they don't even know they have a shell. 

The equivalent to shell scripting is for them stuff like Automator and 
WorKflow: 
-> http://www.kde-apps.org/content/show.php?content=43624

(Automator is not free, so it gets no cookie - I mean no link :) )

Best wishes, 
Arne

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Ein Mann wird auf der Straße mit einem Messer bedroht. 
Zwei Polizisten sind sofort da und halten ein Transparent davor. 

        "Illegale Szene. Niemand darf das sehen."

Der Mann wird ausgeraubt, erstochen und verblutet, 
denn die Polizisten haben beide Hände voll zu tun. 

Willkommen in Deutschland. Zensur ist schön. 
                      (http://draketo.de)
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]