I recently installed a geophysical processing software called Madagascar in Ubuntu 1904. The installation of the program was smooth and I didn't encounter any problems. The problem is that in order to used any program of Madagascar I need to be in Madagascar directory. And before any thing have to type source env.sh to enable environment variables for Madagascar. I have tried to add following line both in .bashrc and .profile but still I need to be Madagascar directory and before anything else need to type source env.sh to run the programs.
shah@vbox:~$ echo 'export PATH=$PATH:/home/shah/madagascar-2.0/env.sh' >> ~/.bashrc
shah@vbox:~$ echo 'export PATH=$PATH:/home/shah/madagascar-2.0/env.sh' >> ~/.profile
shah@vbox:~$ source env.sh
bash: env.sh: No such file or directory
shah@vbox:~$ sfpen
sfpen: command not found
shah@vbox:~$ cd madagascar-2.0/
shah@vbox:~/madagascar-2.0$ source env.sh
shah@vbox:~/madagascar-2.0$ sfpen
NAME
sfoglpen
DESCRIPTION
vplot filter for OpenGL.
SYNOPSIS
sfoglpen colormask= red= green= blue= aspect= ppi= stretchy=n aalias=n aawidth=1 mono=n endpause= cachepipe= shade= wantras= window= frame= overlay= invras= txsquare= serifs= background= redpow=1.0 greenpow=1.0 bluepow=1.0 dither= greyc=1.0 pixc=1.0 txfont= txprec= txovly= xcenter= ycenter= patternmult=1. pause=0 fatmult= rotate=0 txscale=1.0 mkscale=1.0 dashscale=1.0 scale=1.0 xscale=1.0 yscale=1.0 xshift=0. yshift=0. xwmax= ywmax= xwmin= ywmin= fat=0 bgcolor= erase= break= interact= style= size=
Can someone please help me how to properly add path for this program so that I can use Madagascar from any directory. Regards
You should take out the changes you made (they are both superfluous and erroneous) and instead simply add
to the end of one of your shell's interactive startup files. Which one depends on how exactly your Bash is configured, but if you have a
.bash_profile, try that, or else maybe.bashrc.In some more detail, Bash reads different startup files depending on whether the shell is a login shell and/or an interactive shell. Ideally this should be done in an interactive login shell - login because you only want to do it once (subshells would hopefully inherit these settings) and interactive because you only want and need to run this in an interactive session. But again, what exactly will work will also depend on what exactly
env.shcontains.Your
PATHshould not containenv.shbecause it should contain directories, not file names; and presumablyenv.shtakes care of actually updating thePATH. Your shell's configuration almost certainly already containsexport PATHso there is no need to do that again (multiple times!) either.