I am trying to add a folder to the PATH in linux. I want to automate it through a script.
This is the script I have written:
#!/bin/sh
echo "Setting PATH..."
echo "export PATH=$PATH:/opt/mysoftware/scripts/client" >> ~/.bashrc
. ~/.bashrc
Even after executing the script, PATH is not getting updated.
But I can see that bashrc file has been updated.
When I logout and login, PATH is updated.
What might be the problem?
You’re running the script in a child shell. Try sourcing it: