Simple tips when writing scripts

Be it bash, tcsh, perl, ruby, python, etc script, here’s my one simple tips for you:

  • Do not use direct path to the program path in the script’s shebang line – use /usr/bin/env <program> instead.

It’s foolish to assume that everyone have bash in /bin/bash (and it’s even worse if you assumed /bin/sh = bash and recent version of bash will fallback to POSIX feature subset when executed using /bin/sh). And it doesn’t make sense to assume every single perl/ruby/python/etc main binary is in /usr/bin/{perl,ruby,python}.

Instead of doing that, just use /usr/bin/env to let the shell decide where to find specified program. For example if you’re writing bash script, put

#!/usr/bin/env bash

.

This will ensure [1] no one will went RAGE when using your script. I know I did when seeing such scripts. Or as previously stated, #!/bin/sh as the shebang and somewhere in the script it uses [[. Totally (un)funny.

[1] Basically /usr/bin/env will execute the script using program specified in its argument based on PATH specified in the environment variable. It doesn’t matter where the actual binary is located as long it’s in the PATH.

Kaichou wa Meido-sama ep 1

I rarely watch shoujo anime but I think this one doesn’t feel too shoujo-ish. Looks like J.C.Staff tried to make this anime more gender-neutral.

Read more information about this series here. Be careful though – its character section contains some spoiler.

It’s got some light jokes here and there (well, one of its genre is romantic comedy) which I think well executed – at least for first episode.

Its basic premise is simple – a strict, valedictorian but poor student council president works at a maid cafe which then found by a boy which happen to have enough lulz. Hilarity ensues, etc.

The good thing about shoujo series is that the main hero (?) is actually likable unlike some generic eroge-turned-anime shit.

It is also relatively guilt-free (as opposed to B Gata H Kei) and wtf-free (o hai Heroman) and J.C.Staff should be able to produce something relatively amusing…

If you’re looking for light, general comedy for this season, then check either Working!! or this. 😀

Random craps

  • Sometime last week the default color scheme for WordPress’ Dashboard (3.0-alpha) was changed – it is now lighter at least the header part. For example check this blog’s login page.
  • TWGOK / The World God Only Knows / Kami Nomi zo Shiru Sekai is getting anime adaptation. And yes, I also agree that Jun Fukuyama would be perfect fit to be Keima’s VA. In case you’re living under rock, it’s a manga about a galge otaku given task to “capture” “runaway-spirit”-infested real-life girls. No more information currently available as of the time of this post.
  • Some more anime (sequels/new titles) announcements were made and you can check them either in moetron, ANN or Canned Dogs.
  • Latest WordPress requires more memory than ever. I can’t even upload a 1000×1000-something image because of memory exhaustion.