zoglauer / megalib

MEGAlib - the Medium-Energy Gamma-ray Astronomy library
http://megalibtoolkit.com
Other
42 stars 34 forks source link

MEGAlib source call in .bash_profile #92

Open avalluvan opened 4 months ago

avalluvan commented 4 months ago

Context: MacOS 14.3 Shell: /opt/homebrew/bin/bash

Minor edit suggestion to the source command that is added to a terminal's .bash_profile / .bashrc file. Sometimes, a user might be in a directory whose path contains spaces. In this case, a set of commands like

MTMP_HERE = `pwd`
cd /some/other/path/
<do something>
cd ${MTMP_HERE}

will not work. I received the following error statement bash: cd: too many arguments. Changing the last command to

cd "${MTMP_HERE}"

fixed it for me. This change had to be made to the file: /Users/username/MEGAlib/config/env.sh A similar edit exists for the COSItools version of MEGAlib at filepath: /Users/username/COSItools/cosi-setup/source-geant4.sh with variable name "__TMP_HERE".

However, I will add a disclaimer that this may be highly SHELL dependent and I don't know if there is a general fix that will apply to all the various shells bash, zsh, fish, ... out there.