Bash vs Python
A simple case study:
It's not about one programming language killing and replacing the other, its all about the purpose!
The scenario:
Using convert to resize images, both in bash and python just for the fun of it.
First up is BASH:
<b><pre style='color:#000000;background:#ffffff;'>mkdir -p resized find <span style='color:#7f0055; font-weight:bold; '>.</span> -name <span style='color:#2a00ff; '>'*.jpg'</span> -or -name <span style='color:#2a00ff; '>'*.png'</span> -or -name <span style='color:#2a00ff; '>'*.gif'</span><span style='color:#2a00ff; '>\</span> -<span style='color:#7f0055; font-weight:bold; '>exec</span> convert -resize 648x480 <span style='color:#2a00ff; '>'{}'</span><span style='color:#2a00ff; '>\</span> <span style='color:#2a00ff; '>"resized</span><span style='color:#3f3fbf; '>/</span><span style='color:#2a00ff; '>$(basename '{}')"</span> <span style='color:#2a00ff; '>';'</span> </pre>
Its Pythons turn:
from glob import glob from os.path import splitext from os import system if not path.exists('resized'): mkdir('resized') for pic in glob.glob('*'): if os.path.splitext(pic)[1] in ext: system('convert -resize 640x480 "%s" "resized/%s"' % (pic,os.path.splitext(pic)[0]))

Recent blog posts
- watir-webdriver web inspector
- gem list to gemfile
- Packing ruby2.0 on debian.
- Made it into The Guinness Book!
- to_h in ruby 2.0
- Filter elements by pattern jQuery.
- Better HTML password fields for mobile ?
- Grayscale image when user offline
- nth-child CSS pseudo-class Christmas colors
- EventEmitter in nodejs