THE WORLD DISCUSSES #PYTHIAN ON TWITTER. HAVE A QUESTION? USE OUR HASHTAG AND ASK AWAY.

Saying What You Mean

Ah, the perils of working in a shared, client environment. One client has us using a login that is not exclusive to us. I prefer using bash; the client is set to use zsh. This is not a problem in and of itself.

However, there is a section in the .profile that is causing me issues:

if [ -f /usr/bin/ksh ]; then
        /usr/bin/ksh -o vi
        exit
fi

So, “If ksh exists, run it with some options to edit history with vi-like commands”. Except what we really want is “If you’re using the ksh as a shell, . . . .”

So I added a modification, and now all is fine.

if [ -f /usr/bin/ksh ]; then
        if [ "$SHELL" = "/usr/bin/ksh" ]; then
                /usr/bin/ksh -o vi
                exit
        fi
fi

(not all my problems are MySQL related!)

One Response

  1. Bill Karwin says:

    Why are you starting another instance of the ksh shell if you know the current process is already a running ksh shell? You can activate the vi behavior of command history editing in the current ksh shell:
    $ set -o vi

    Also, just because $SHELL is set to a value doesn’t guarantee that it’s accurate. And ksh isn’t always in /usr/bin. It’d be a bit more reliable to test for `basename $0` = ksh.

Leave a Reply

Start NowWith Pythian - database design, management and emergency handling capabilities...

Live Updates

pythian: RT @FN_Press2: Schooner Information Technology Teams with Pythian to Deliver Advanced Support and High... http://finanznachrichten.de/20
more



Testimonials

  • Serge Racine

    DBA, Brookfield Energy

    We are very satisfied by the service given to us by Andre and Shakir in support of our recent data quality and reorganization initiative.... more