I am trying to use a script to add a folder with automation scripts to the replit path variable. Once the script ends the path variable is unchanged. I’ve read this is because it isn’t updated in bashrc.
I can’t edit bashrc. on replit. How can I update the global path variable on replit and make it stick by using a script?
code snippet
Welcome to Ask! I’m not sure this is possible. I was able to edit .bashrc
using nano
, but the changes I made were not reflected so
.
1 Like
So, I do know a bit about what you’re talking about. By using a script to install scripts to the $PATH
, you are doing the right thing for now, but it will not save once the Repl is reset. Instead, try this:
- Make it install to a directory that is saved (
/home/runner/whatevertheprojectis
)
- Try editing the PATH variable using
[env]
in .replit, sorta like this (i am not great with editing the .replit file, look it up in the docs)
[env]
PATH = "$PATH:~/projectname/myfolder/bin"
It should be able to access it now. If the files need to load libraries, set $LD_LIBRARY_PATH
too.
It’s the only idea I have, sorry if it doesn’t work.
1 Like
You can edit it in SECRETS and that works for me.
In bash I echo $PATH:$PWD/folder
Copy this and then make a new secret named PATH and paste this echo there. Reload the shell and your $PATH will be updated and remain when you close and reopen the repl.
~/shell$ echo $PATH:$PWD/folder
2 Likes