Bash typecasting

Filed under
HowTos

A recent post here mentioned typecasting in the shell. I responded by advising the poster to use some other language for his scripting needs. My feeling is that while I do appreciate that Bash can be used for complicated tasks, I just don't see the point: use a language that matches your expectations for features. For me, that's Perl, but others might choose Python or Php or Java or who knows - but if you bring the right tool (or a tool you know well), jobs go much easier.

But back to bash and its typecasting. Bash does let you declare how you intend to use a variable. Let's do it "wrong" first:

Full Story.