ID:751724
 
I recently have installed the server version of Ubuntu on an old computer and have been toying around with it by SSHing in through putty. The default path variable doesn't contain the loopback path so on each log in I have to do PATH=$PATH:. or I have to use sh to launch my shell scripts. Anyway to add . to the default PATH so it's properly set up on each log in?

Also is there any way to launch a program without blocking the shell? I found nohup which kinda works by routing the standard output to a file and it'll keep a program running even if I close putty but it still blocks up my shell so I have to close putty and launch a new instance of it to go back to using the shell while a program is running.
I'm not quite sure why you want to add . to your PATH. You can run applications in the directory you are in by using the command ./my_app That ensures that you run the app from the current directory as opposed to any other directory in the path and it will execute it regardless.

To add a directory to the path of a single user, place the lines in that user's .bash_profile file. Typically, .bash_profile already contains changes to the $PATH variable and also contains an export statement, so you can simply add the desired directory to the end or beginning of the existing statement that changes the $PATH variable. However, if .bash_profile doesn't contain the path changing code, simply add the following two lines to the end of the .bash_profile file:

PATH=$PATH:/data/myscripts
export PATH

Lastly, to run a program in a terminal and receive a prompt back, simply use the &.
Example:
my_app &

The output from my_app would still show up in the terminal, but you would be able to run other apps regardless. If you wanted to redirect the output or input, you still can, just add an & at the end.
my_app > file.txt 2> err.txt &