Joerg Jaspert: Bash power
Something that regularly happens when I get to see other peoples shell scripts is me thinking Why do they not use the powers of bash? .
Sometimes it s fine to not use bash specific features, like when you are limited by the Operating System you have to run on (don t you try some commercial Unix systems. Or this WIndows crap. Brrr). Sometimes you want it for some perceived performance win, sometimes a full bash doesn t fit the target system (think embedded devices). Thats all fine, don t come up with those, I know them.
What I mean is - people are using things that bind you to bash and your hashbang also makes your script use bash. But people still jump out to a different command just for some variable modification which are easily doable in bash too.
A few examples follow, always imagine them in a script starting with the header of
Example Get rid of newlines (actually, any replacement you can think of):
Example Removing a prefix (or suffix) from a string:
There are many more possibilities, you might want to look through the Advanced Bash-Scripting Guide, it contains some helpful information. Or read the bash manpage. Or (shameless self-ad) look at the latest ftpsync script, the one and only official (mirroradm) supported mirror synchronization for the ftp.*.debian.org mirrors.
#!/bin/bash set -e set -u
Example Get rid of newlines (actually, any replacement you can think of):
var1="something with
space and
linefeeds"
var1=$ var1//
/_
echo $var1
This is a simple but powerful demonstration of the Pattern substitution bash can do for you. Read its manpage, it can do much more than what I list here, but the above simply replaces all occurences of a linefeed with an _. Make the double // a single one and it is just the first that is replaced.
Example Removing a prefix (or suffix) from a string:
VAR1=$ VAR1##sync:archive:
This removes the text sync:archive: from the beginning of the VAR1 variable. Replace the ## with %% and its gone from the end. The topic to look for in the manpage of bash is Remove matching prefix pattern (or suffix, of course).
There are many more possibilities, you might want to look through the Advanced Bash-Scripting Guide, it contains some helpful information. Or read the bash manpage. Or (shameless self-ad) look at the latest ftpsync script, the one and only official (mirroradm) supported mirror synchronization for the ftp.*.debian.org mirrors.
I found myself with a problem: trying to linearly edit a movie clip
with a non-linear editor isn't very simple, nor is it meant to be.
Case at hand: I have about 1 hour and 40 minutes of film material
that was recorded with
Haskell provides type classes to support polymorphism. A type class defines a few methods, which can then be implemented for a concrete type in the type class instance. This is a powerful system, but it also has it drawbacks. Most notably, each type can have at most one implementation of the type class. But sometimes you need to use a different implementation.
If, for example, you used the
While I normaly don t care much about Ubuntu, I m subscribed to lauchpad.net for the packages I m
At my last job, I created several web applications designed to replace
built-in apps on mobile phones. While modern browsers and HTML5 made this
incredibly easy in many ways, we still ended up writing native (i.e. non-web)
code for most of our applications. There were a few different areas where the
browser alone didn't meet our needs, but one that I found suprisingly common
was background processing.
Consider the following mobile applications:
If you re convinced that cloud is a useless buzzword, being used to describe everything under the sun, old and new, then well, you re right that is, except for the useless part. It s true that this word is being (ab)used in many different products, services and technologies, which do not seem to relate to each other in any concrete way. Cloud in the abstract is being defined in many different ways, based on different fundamental characteristics of cloud technology . Nonetheless, there is something genuinely important going on here, and this is my view of what it s about.
The hype
Countless business which only had web sites or web applications in 2008 now call them cloud services . They aren t delivering any new benefits to their users, and they haven t redesigned their infrastructure. What do they mean by this?
Cloud is defined, some say, by where your data is kept, and cloud means 

When I'm too lazy to find API documentation I just read the source code. To make this slightly easier in Python, here's what I use in my
Once again, I was invited by several different groups to be present at
This Monday saw the 114th running of the Boston Marathon. Under near-ideal
conditions with some sunny skies, some clouds and moderate temperatures in the high 40s to low 50s,
a course record as well as US Mens record were set. Having run this race
After skipping 3 entire releases, and 18 months later, here we are, finally:
Bdale has just opened up the
I'm pleased to announce that the new