1

I am using ubuntu 12.04. I have a custom script at my home directory, named ~/configure/run-server. Here -
configure - is directory at my home
run-server - is script at that runs tomcat and check some constraint/prerequisite to run my project on tomcat. This script has no other dependency.The script is executable and runs fine without any errors.

To run the script I have to do -

$ ./configure/run-server 

But I want to run the - run-server script like like regular command eg.- cp, mv, scp etc. To run these command we don't need to specify any other extra thing. How can I do this for the run-server command?

Thanks

2
  • 1
    Just put $HOME/configure in your PATH Commented Jul 29, 2015 at 5:35
  • 1
    Or you can just add an alias. alias run-server "$HOME/configure/run-server" Commented Jul 29, 2015 at 5:43

1 Answer 1

1

Since you are in ubuntu this hack will work for you. I am not sure about the other linux distribution. Follow these steps -
1. Create a directory named bin at your home -

$ mkdir bin

2. Then place your run-server script to it.
3. Now look at your ~/.profile file. This file contains information about the bin directory at your home. Now the bin directory works as your private bin. If your ~/.profile file doesn't contain any information about the bin directory then you can add the following line in your ~/.profile -

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi  

Now you can use the script run-server like a regualar command only from your home.

If you want to get access the run-server command from all over your environment (ie.- from other user homes, or from any other places) place your run-server command to the /usr/bin directory. But I think the first one is the best option.

You may also see this link.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.