Kushal Das

FOSS and life. Kushal Das talks here.

cd revisited

Few days back wrote a function ‘cd’, which later found is not correct. So, came up with a smaller one with no problem (till now :) ).

cd ()
{
if [ “$#” -eq “0” ]
then
    if [ “$eFlag” -eq “1” ]
    then
        changePath
        export eFlag=0
    fi
    builtin cd
else
    builtin cd “$1”
    dname=pwd
    bname=echo "$dname"|grep pyqt4
    if [ “$bname” != “$dname” ]
    then
           if [ “$eFlag” -eq “1” ]
           then
                changePath
                export eFlag=0
           fi
     else
           if [ “$eFlag” -eq “0” ]
           then
                QTDIR=/home/kdedev/src/kde/qt-copy
                PATH=$QTDIR/bin:$PATH
                MANPATH=$QTDIR/doc/man:$MANPATH
                LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
                PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH
                QTINC=$QTDIR/include
                QTLIB=$QTDIR/lib
                export QTDIR PATH MANPATH LD_LIBRARY_PATH PKG_CONFIG_PATH QTINC QTLIB
                export eFlag=1
            fi
     fi
fi
}
Total code can be found here.

comments powered by Disqus