~abenson/galacticus/installScripts

« back to all changes in this revision

Viewing changes to galacticusInstall_v0.9.1.sh

  • Committer: Andrew Benson
  • Date: 2011-11-20 01:50:01 UTC
  • Revision ID: abenson@caltech.edu-20111120015001-yi9pozwqja1hact1
* Improve removal of aliases from .bashrc and .cshrc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1968
1968
read -p "Add a Galacticus environment alias to .bashrc? [no/yes]: " RESPONSE
1969
1969
if [ "$RESPONSE" = yes ] ; then
1970
1970
    if [ -e $HOME/.bashrc ]; then
1971
 
        awk 'BEGIN {inGLC=0} {if (index($0,"Alias to configure the environment to compile and run Galacticus v0.9.1") > 0) inGLC=1;if (inGLC == 0) print $0; if (inGLC == 1 && index($0,"export GALACTICUS_FLAGS")) inGLC=0}' $HOME/.bashrc > $HOME/.bashrc.tmp
 
1971
        awk 'BEGIN {inGLC=0} {if (index($0,"Alias to configure the environment to compile and run Galacticus v0.9.1") > 0) inGLC=1;if (inGLC == 0) print $0; if (inGLC == 1 && index($0,"'"'"'")) inGLC=0}' $HOME/.bashrc > $HOME/.bashrc.tmp
1972
1972
        mv -f $HOME/.bashrc.tmp $HOME/.bashrc
1973
1973
    fi
1974
1974
    echo "# Alias to configure the environment to compile and run Galacticus v0.9.1" >> $HOME/.bashrc
1990
1990
read -p "Add a Galacticus environment alias to .cshrc? [no/yes]: " RESPONSE
1991
1991
if [ "$RESPONSE" = yes ] ; then
1992
1992
    if [ -e $HOME/.cshrc ]; then
1993
 
        awk 'BEGIN {inGLC=0} {if (index($0,"Alias to configure the environment to compile and run Galacticus v0.9.1") > 0) inGLC=1;if (inGLC == 0) print $0; if (inGLC == 1 && index($0,"setenv GALACTICUS_FLAGS")) inGLC=0}' $HOME/.cshrc > $HOME/.cshrc.tmp
 
1993
        awk 'BEGIN {inGLC=0} {if (index($0,"Alias to configure the environment to compile and run Galacticus v0.9.1") > 0) inGLC=1;if (inGLC == 0) print $0; if (inGLC == 1 && index($0,"'"'"'")) inGLC=0}' $HOME/.cshrc > $HOME/.cshrc.tmp
1994
1994
        mv -f $HOME/.cshrc.tmp $HOME/.cshrc
1995
1995
    fi
1996
1996
    echo "# Alias to configure the environment to compile and run Galacticus v0.9.1" >> $HOME/.cshrc