> On Mar 13, 2015, at 12:42 PM, Petr Leiman <petr.lei...@epfl.ch> wrote:
> 
>  this is how we are supposed to use CCP4 today anyway.

I’ve never been big on doing what I am told I am supposed to do, so I have been 
using this:

use this to put it at the end of the path:

ccp4_first_in_path=0

or this to put it at the beginning:

ccp4_first_in_path=1


with the following for bash and zsh:



if [[ $ZSH_NAME != "zsh" ]];then

    # This is specific to bash, so protect it from zsh users

    # CCP4 executables and scripts live in $CBIN and $CETC respectively; put 
them
    # on the path in an appropriate order for scripts to be used as wrappers for
    # binaries of the same name.  Put ccp4 stuff after the current path to avoid
    # confusion with `.' or whatever in the path:
    #
    # This construct prevents the path getting longer each time ccp4.setup is
    # executed (A. Perrakis)
    # 
    ccp4pathlist="${CCP4}/etc ${CBIN}"
    #
    for dir in ${ccp4pathlist}; do
      if [[ `expr ":${PATH}:" : ".*:${dir}:"` -eq 0 ]]; then
        if [[ $ccp4_first_in_path -eq 1 ]]; then
          export PATH="${dir}:${PATH}"
        else
          export PATH="${PATH}:${dir}"
        fi
      fi
    done


else
    # This is specific to zsh, so protect it from bash users

        if [[ $ccp4_first_in_path == 1 ]]; then
            PATH=${CCP4}/etc:${CBIN}:$PATH
        else
            PATH=$PATH:${CCP4}/etc:${CBIN}
        fi

        typeset -U path   # This construct prevents the path getting longer 
each time 
                          # ccp4.setup is executed in zsh.
        export PATH


fi

Reply via email to