I saved a shell script in bin(created by me). When I run the program, to avoid ./ to run the script I need to copy the script to one of the directories specified by PATH variable. The bin directory created is not in the path list. So, to add to the PATH list:
export PATH=~/bin:"$PATH"
But this directory is not getting saved to the PATH list. When I open a new terminal window I need to export it again to run the script. How can I add it to PATH list permanently? Also if I try to move the script to the present PATH listed directory, it says PERMISSION DENIED. Do I have to move it by becoming a root user?
~/bin
, you need to log out/in or runsource ~/.profile
apply. No need to add it to$PATH
manually. Other issue might be that the script needs to be executable. Please mention the situation.PATH
variable. Doecho $PATH
and copy it here. Second, contents of your~/.profile
would be nice. Use paste.ubuntu.com and provide the link. Also, what type of system is this ? Is it desktop ? are you using it over SSH ? are you the only user of the system or you have admin who sets up things for you ? Also what version of Ubuntu ?