Monthly Archives: May 2013

Help is available in the net.

As you see, one can spend quite a time on comparison of unstructured objects. But dont expect you are done with it by studying those pages.

For example one might expect

if [[ "Aha" ==   *   ]]
if [[   *   == "Aha" ]]

to be equivalent. But then things would be too simple. Note that this is not about expansion.

Speaking of if, which of the following lines are ok?

if [ "aha"=="aha" ]
if [ "aha" == "aha" ]
if [[ "aha" == "aha" ]]
if [[ "aha" = "aha" ]]
if [["aha" == "aha"]]
if [ ["aha" == "aha"] ]
if [ [ "aha" == "aha" ] ]

Some background: In complex software assemblies a processing pattern named ‘condition’ turned out to be highly valuable and bash fully supports this concept by means of the ‘if’-structure. It is not designed for beginners. Though, provided a certain expertise, the deployment of the structure can be realized on short notice.


if [[ "aha"=="aha" ]] ;
    echo "yes" 

Hint: There are positions where you can put semicolons or white spaces and others where you cant. You have to think about it? This means that bash is a fail.