Blog

  • best practices in shell script programming – colons

    My snipplet for an if/then/else in shell scripts looks like this:

    if true

    then :

    else :

    fi

    The colons make that code syntactically complete, w/o the colons you run into a syntax error. The colon is the “null op” of (Bourne) shell scripting.
    And the colons usually remain there for the remainder of the life of that code.
    Have you noticed, that the youngsters, that talk about snipplets nowadays seriously think, they invented them? True, I guess, they created the term. Just the term.

  • best practices in shell script programming – double quotes

    You do know the result of this:

    a=A; echo $a

    But are you just as sure here?

    a=A; b=B; echo $a.$b

    That depends on the shell, you are using. So I suggest you better write it this way:

    a=A; b=B; echo ${a}.${b}

    Enclosing variable names in curly braces is quite often a good idea.
    Look at the following piece of code:

    case $var in

      x*)

        echo var starts with x

        ;;

      *)

        echo var starts with something else

        ;;

    esac

    Looks alright, doesn’t it?
    No, it’s does not. If that variable had not been assigned a value before or is of zero length, you will see an ugly syntax error occur.
    Therefore enclose the variable in double quotes like here:

    case “$var” in

      x*)

        echo var starts with x

        ;;

      *)

        echo var starts with something else

        ;;

    esac

    There is no good excuse for not doing it anywhere. It may look ugly and unnecessary, but it will help. That’s the way shell scripting is. I learned this from Jürgen Gulbins around 1987, when I enjoyed working for him. This series of articles is dedicated to him. I owe him a lot.
  • best practices in shell script programming

    You do know the result of this:

    a=A; echo $a

    But are you just as sure here?

    a=A; b=B; echo $a.$b

    That depends on the shell, you are using. So I suggest you better write it this way:

    a=A; b=B; echo ${a}.${b}

    Enclosing variable names in curly braces is quite often a good idea.

  • Task::Kensho – “A Glimpse at an Enlightened Perl”

    See its manual page at CPAN!

    • The installations with/for my self-brewn perl-5.12.1 on openSUSE-11.2 as well as on OS X Snow Leopard have a problem with Task::Kensho‘sTryCatch, I skip that, and all the remainder seems to be fine.
    • The installation with/for my self-brewn perl-5.10.1 on openSUSE-11.2 runs straight through.
    • The installation with/for the “native” perl-5.10.0 on my openSUSE-11.2 runs straight through.




     
  • App::cpanminus – a new CPAN installer

    How to …:

    $ perlbrew switch stable # resp.
    $ perlbrew switch perl-5.12.1
    $ cpan  App::cpanminus
    $ cpanm App::cpanminus
    $ perlbrew install-cpanm # use this variant!!!

    $ perlbrew switch perl-5.10.1
    $ cpan  App::cpanminus
    $ cpanm App::cpanminus
    $ perlbrew install-cpanm # use this variant!!!

    To be continued …

  • cookie hell …

    sites w/o general admission so far:

    • xing.com
    • Google Calendar

    exceptions:

    • draft.blogger.com
    • www.twitter.com 
    • www.blogger.com 
    • mail.google.com
    • www.facebook.com 
    • chrome.google.com
    • www.inkedin.com
    • www.google.com
    • fritz.box – my multi-functional router
    • oreilly.com

    I would love to be able to not give further general admissions to cookie senders.
    Cookies kill me, sort of.

  • AdBlock …

    Ads are actually BLOCKED FROM DOWNLOADING now, instead of just being removed after the fact!

    One of these milksops told me “the other day”, that wouldn’t be true, and I couldn’t prove him wrong then. It hurts having trusted yet another shameless lie.


    If you notice Google Chrome as a tag here, that means, there is now AdBlock for Google Chrome.
  • created more wiki web profiles …

    MoinMoin offers a web GUI, but not for Google Chrome.
    Both are very nice wiki systems with pretty comfortable markdown.

    Credos written as profiles.

  • creating my 1st DocBook Website web-sites

    I have the DocBook XSL book in front of me (opened at “Chapter 31. Website“), asking myself and the world (irc://irc.freenode.net#docbook) silly questions, like the ones, you can find as my recent articles on this blog.

    I want to change a couple of pretty raw vanilla DocBook web sites to pretty raw but neat vanilla DocBook Website web sites during the next couple of hours. There is other work to complete pretty soon, so I rather complete this thing now.

    I am using docbook-website-2.6.0/example from Sourceforge (look around here!! ((FIXME))) (of course as example-JH-0, so I can always diff to the origin).
    Their Makefile-example.txt is now my Makefile, I just had to adapt DOCBOOK_WEBSITE and XSLT:

    • DOCBOOK_WEBSITE=/usr/local/docbook-website-2.6.0
    • XSLT=xsltproc


    Try this:

    $ make clean
    $ make realclean
    $ make depends
    $ make

    Update / 2010-07-14:
    I have made pretty good progress during the last couple of days.
    I converted a couple of plain DocBook web-sites (HTML!!) to DocBook Website, and I rather sense some satisfaction there. You can find those web-sites right here in the right column listed as my most exciting web-sites. Sorry for the bragging, but the Website guys did a rather good job, so even me cannot spoil that a lot.
    Right, and a web-designer mate of mine will show up on Friday, and we are going to discuss the replacement logos for all the NDW-logos around there. And a very big “thank you!!!” here to Norman for all his good work!!!

  • DocBook Website – where to get the Relax-NG schema from?

    I found it at SourceForge.
    I really love editing XML in Emacs’s nxml-mode. I did mention that at my DocBook Wiki home page already.