cd revisited


Posted: 2007/05/05 00:01:27 | Source | More posts about FOSS problem Shell

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
Contents © 2004-2014 Kushal Das - Powered by Shonku