I would like to run external command from Mathematica. For this I need to have bash environment configured via reading the content of ${HOME}/.bashrc file. When I execute the following code in Mathematica notebook
ReadList["!echo $PATH", String]
the content of PATH variable is not set as it is in ${HOME}/.bashrc. The same happens when I explicitly load bash configuration file
ReadList["!source ${HOME}/.bashrc; echo $PATH", String]
(strictly speaking the above command makes no effect!). So the question is: is it possible to load the configuration stored in .bashrc file in Mathematica external call under the Linux system (of course without explicitly setting e.g. mentioned PATH variable is not a solution for me)?
try ReadList["!printenv",String]start by figuring aout what shell is running and what environment is avaialable. $\endgroup$Run? $\endgroup$Readlist["!/bin/ps -p $$"]-- In my case I've got the bourne shell /bin/sh. printenv incorrectly shows the SHELL variable inherited from the shell used to invoke mathematica. So.. make shure your bashrc doesnt do anything incompatable with plain /bin/sh .. $\endgroup$ReadList["!echo $PATH", String]gives me{"/usr/bin:/bin:/usr/sbin:/sbin"}which is expected since it did not read the contents of my bashrc file. If I doReadList["!source $HOME/.bash_profile; echo $PATH", String]then I get all of the path that I have set up in there. $\endgroup$ReadList["!source $HOME/.bashrc; echo $PATH", String]does not take any effect for me. $\endgroup$