imjustaguy imjustaguy - 1 month ago 8
Bash Question

Install script for private use in ubuntu

I created a script and i want to install it for my private use, i do this steps:

Set execute permission as follows:

$ chmod 755 demo


Run it & test it as follows:
$ ./demo Hello World


Copy script to your own bin directory (Install script for private use)
$ cp demo ~/bin


Check whether it is working or not
$ demo

$ demo Hello World


But i get this error:
No command 'demo' found

Answer

You will need to add the ~/bin path to $PATH environment variable so that the shell can find the demo executable.

$ PATH=$PATH:~/bin
$

OR

You can specify the whole path to demo executable like this:

$ ~/bin/demo Hello World

Comments