When I echo $PATH
in a terminal window, it outputs:
/home/charles/anaconda3/bin:
/home/charles/anaconda3/condabin:
/usr/local/sbin:/usr/local/bin:
/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
/usr/local/games:/snap/bin:/snap/bin:
/home/charles/.emacs.d/bin
But when I run the script (not as root):
#!/bin/sh
echo $PATH
it only outputs the root paths, not the ones from my home directory:
/usr/local/sbin:/usr/local/bin:
/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
/usr/local/games:/snap/bin:/snap/bin
I'm trying to launch spyder
from a script, which comes from:
$ which spyder
/home/charles/anaconda3/bin/spyder
Is there some way to make the script recognize the parts of the path from my home directory?
Solved: I moved the code adding emacs
and anaconda
to the path from ~/.bashrc
to ~/.profile
.
/home/charles/...
to yourPATH
? What is the first line of your script? (= Is the script run bybash
or bysh
?) Please [edit] your question to provide this information, don't use comments for this purpose. – Bodo Jun 01 '22 at 14:46