Skip to content

Instantly share code, notes, and snippets.

@stowler
Last active December 20, 2015 23:28
Show Gist options
  • Save stowler/6212443 to your computer and use it in GitHub Desktop.
Save stowler/6212443 to your computer and use it in GitHub Desktop.
afniSwitchFromRepo.sh - temporarily switch from the neurodebian repo version of AFNI to a local alternative
#!/bin/bash
# afniSwitchFromRepo.sh
#
# A script to tempoarily switch the user from the neurodebian repo version of
# AFNI to a local alternative install (e.g., /opt/abin). Works in combination
# with afniSwitchToRepo.sh
# Specify the parent directory of alternative AFNI's binaries:
# e.g., afniAlternativePath=/opt/abin
afniAlternativePath=/opt/abin
# Clear any AFNI environmental variables:
unset `env | awk -F= '/AFNI/ {print $1}' | xargs`
# Backup the user's current $PATH to an environmental variable so we can switch back
# to it later:
export afniRepoVersionOfPATH=${PATH}
# Prepend the path of the alternative (non-repo) version of afni to the user's $PATH:
export PATH=${afniAlternativePath}:${PATH}
# Print afni version info to the terminal:
echo ""
echo "Switching to the non-repo version of AFNI:"
echo ""
echo "----------- active afni version and variables: -----------"
afni -ver
echo -n "The command 'afni' will launch: "
which afni
echo -n "The command '3dinfo' will launch: "
which 3dinfo
echo "AFNI environmental variables, if any exist:"
env | grep AFNI
echo "----------------------------------------------------------"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment