--- install.sh~ 2011-07-27 06:12:30.000000000 +0000
+++ install.sh  2011-07-27 07:56:50.000000000 +0000
@@ -1687,25 +1687,19 @@
   sed -e "s/CCP4I_TCLTK \/usr\/bin/CCP4I_TCLTK ${sedtcl}/g" tmp_setup > ${current}/ccp4-$CCP4_VER/include/ccp4.setup-csh
   #sed -e "s/\/xtal/${sedcurr}/g" ${current}/ccp4-$CCP4_VER/include/ccp4.setup-bash > tmp_setup
   #sed -e "s/CCP4I_TCLTK \/usr\/bin/CCP4I_TCLTK ${sedtcl}/g" tmp_setup > ${current}/ccp4-$CCP4_VER/include/ccp4.setup-bash
-  myshel=`echo $SHELL | grep bash`
-  if test "$myshel" = ""; then :
-    myshel=`echo $SHELL | grep csh`
-    if test "$myshel" = ""; then :
-      myshel=`echo $SHELL | grep zsh`
-      if test "$myshel" = ""; then :
-        myshel=`echo $SHELL | grep sh`
-        if test "$myshel" != ""; then :
-          myshel=ccp4.setup-sh
-        fi
-      else
-        myshel=ccp4.setup-zsh
-      fi
-    else
-      myshel=ccp4.setup-csh
-    fi
-  else
-    myshel=ccp4.setup-bash
+  case $SHELL in
+    *bash*) myshel=ccp4.setup-bash;;
+    *zsh*)  myshel=ccp4.setup-zsh;;
+    *csh*)  myshel=ccp4.setup-csh;;
+    *)      myshel=ccp4.setup-sh;;
+  esac
+  if [ ! -e ccp4-$CCP4_VER/include/${myshel} ]; then
+    case $SHELL in
+      *csh*) myshel=ccp4.setup-csh;;
+      *) myshel=ccp4.setup-sh;;
+    esac
   fi
+
   cd ccp4-$CCP4_VER
   cp include/${myshel} include/ccp4.setup
   . include/ccp4.setup-sh
@@ -1793,15 +1787,19 @@
         mv ${installdir}/ccp4-$CCP4_VER/src/phaser-utf ${installdir}/ccp4-$CCP4_VER/src/phaser
       fi
     else
-      if test -d ${installdir}/ccp4-$CCP4_VER/lib/cctbx; then :
-        mv ${installdir}/ccp4-$CCP4_VER/lib/cctbx-ucs/* -t ${installdir}/ccp4-$CCP4_VER/lib/cctbx
-      else
-        mv ${installdir}/ccp4-$CCP4_VER/lib/cctbx-ucs/ ${installdir}/ccp4-$CCP4_VER/lib/cctbx
+      if test -d ${installdir}/ccp4-$CCP4_VER/lib/cctbx-ucs; then :
+        if test -d ${installdir}/ccp4-$CCP4_VER/lib/cctbx; then :
+          mv ${installdir}/ccp4-$CCP4_VER/lib/cctbx-ucs/* -t ${installdir}/ccp4-$CCP4_VER/lib/cctbx
+        else
+          mv ${installdir}/ccp4-$CCP4_VER/lib/cctbx-ucs/ ${installdir}/ccp4-$CCP4_VER/lib/cctbx
+        fi
       fi
-      if test -d ${installdir}/ccp4-$CCP4_VER/src/phaser; then :
-        mv ${installdir}/ccp4-$CCP4_VER/src/phaser-ucs/* -t ${installdir}/ccp4-$CCP4_VER/src/phaser
-      else
-        mv ${installdir}/ccp4-$CCP4_VER/src/phaser-ucs/ ${installdir}/ccp4-$CCP4_VER/src/phaser
+      if test -d ${installdir}/ccp4-$CCP4_VER/src/phaser-ucs; then :
+        if test -d ${installdir}/ccp4-$CCP4_VER/src/phaser; then :
+          mv ${installdir}/ccp4-$CCP4_VER/src/phaser-ucs/* -t ${installdir}/ccp4-$CCP4_VER/src/phaser
+        else
+          mv ${installdir}/ccp4-$CCP4_VER/src/phaser-ucs/ ${installdir}/ccp4-$CCP4_VER/src/phaser
+        fi
       fi
     fi
   fi
@@ -1886,7 +1884,9 @@

 #Copying ccp4 setup scripts
 if test "$HAS_CCP4" != ""; then :
-  cp ccp4-$CCP4_VER/include/ccp4.setup-zsh setup-scripts/
+  if test -f ccp4-$CCP4_VER/include/ccp4.setup-zsh; then:
+    cp ccp4-$CCP4_VER/include/ccp4.setup-zsh setup-scripts/
+  fi
   cp ccp4-$CCP4_VER/include/ccp4.setup-csh setup-scripts/csh/ccp4.setup
   cp ccp4-$CCP4_VER/include/ccp4.setup-sh setup-scripts/sh/ccp4.setup
   echo "To setup CCP4 environment, source the file setup-scripts/<yourshell>/ccp4.setup "
@@ -1960,8 +1960,8 @@
         shel=`echo $SHELL | grep csh`
         if test "$shel" = ""; then :
           echo " " >> ${HOME}/.${shell2}rc
-          echo "source $installdir/setup-scripts/sh/ccp4.setup" >> ${HOME}/.${shell2}rc
-          echo "source $installdir/setup-scripts/sh/ccp4-others.setup" >> ${HOME}/.${shell2}rc
+          echo ". $installdir/setup-scripts/sh/ccp4.setup" >> ${HOME}/.${shell2}rc
+          echo ". $installdir/setup-scripts/sh/ccp4-others.setup" >> ${HOME}/.${shell2}rc
         else
           echo " " >> ${HOME}/.${shell2}rc
           echo "source $installdir/setup-scripts/csh/ccp4.setup" >> ${HOME}/.${shell2}rc
@@ -2005,8 +2005,8 @@
     shel=`echo $SHELL | grep csh`
     if test "$shel" = ""; then :
       echo " " >> ${HOME}/.${shell2}rc
-      echo "source $installdir/setup-scripts/sh/ccp4.setup" >> ${HOME}/.${shell2}rc
-      echo "source $installdir/setup-scripts/sh/ccp4-others.setup" >> ${HOME}/.${shell2}rc
+      echo ". $installdir/setup-scripts/sh/ccp4.setup" >> ${HOME}/.${shell2}rc
+      echo ". $installdir/setup-scripts/sh/ccp4-others.setup" >> ${HOME}/.${shell2}rc
     else
       echo " " >> ${HOME}/.${shell2}rc
       echo "source $installdir/setup-scripts/csh/ccp4.setup" >> ${HOME}/.${shell2}rc
@@ -2018,10 +2018,10 @@
     echo "You will need to manually source the CCP4 setup scripts before you can run CCP4"
     echo "and its associated programs. There are two scripts to source."
     echo ""
-    echo "For bash shell:"
+    echo "For bash/zsh/sh shell:"
     echo ""
-    echo "   source $installdir/setup-scripts/sh/ccp4.setup"
-    echo "   source $installdir/setup-scripts/sh/ccp4-others.setup"
+    echo "   . $installdir/setup-scripts/sh/ccp4.setup"
+    echo "   . $installdir/setup-scripts/sh/ccp4-others.setup"
     echo ""
     echo "For csh/tcsh shell:"
     echo ""
