ubuntu - Trouble adding ".sh" file to environment . -


i have application requires me start within "bin" folder running follows :

./pio commad 

i want able run without entering folder , running file "manually" (so say) . how may modify system such file may used following :

pio command 

how go doing ?

i newbie linux please provide me answer appropriate skill level . give me principles, give me links, give me clarity .

there exists variable called path in every sh/bash session. example:

$ echo $path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games 

every 1 of directories, declared syntax directory1:directory2:directory3, place bash looks executable when type command.

if type mousepad file.txt find executable called "mousepad" in folder /usr/bin.

if want program called same way mousepad must either:

  • place in 1 of directories contained in $path
  • place link (symbolic or not) program in 1 of directories `$ sudo ln -s "/home/username/mydir/myprogram" /usr/local/bin/"
  • add directory in $path variable
    $path=$path:/home/username/mydir

as alternative, can alias command with

$ alias commandiwanttorun="/home/...../...../myprogram" 

an run commandiwanttorun

if chose not move program, beware new terminal session changes $path , alias disappear. in case, might want create, if doesn't exists, file called /home/username/.bash_aliases , put inside commands want automatically run @ beguinning of every session. more information search .bash_aliases on stackoverflow.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -