What do I need to do so that my C ++ program runs only by entering a name on my unix system

Possible duplicate:
Code won and run. [no]

I wrote and compiled the program, and I want to make it so that I can simply enter the name of the program from the shell so that it starts instead of going to the directory in which the program is located and typing. / In front of the program name. If possible, let me know.

+3
source share
5 answers

You should learn PATH methods if you are going to go with me to Alderaan.

+16
source

, PATH.

, /home/jimmy/cpp

type ( $- )

PATH=$PATH:`pwd`
$myprog

export bashrc, . ( bash )

+5

, . ( ) PATH - .

, . , , . , - , mv.

. mv onefile twofile... t22 > (./mv) mv , ! , . , mv /usr/bin/mv. .

( : mv . ... )

, , . , "" .

! mv mc, mv. , mv onefile twofile, mc. "" , mc , , . , .

, PATH , , , , , ./ (, ./IMeanToRunThis)

+4

$HOME/bin , , . /usr/local/bin , . , , $HOME/bin.

, , /bin /usr/bin, . C:\Windows C:\Windows\System32. .

PATH , , . , , . PATH, , - .

: , Windows boxen. C:\Program Files C:\Programs. bin . C:\programs\bin , $HOME/bin * nix (.. Windows), , * nix, , C:\Programs\mingw, C:\programs\MSYS C:\programs\cygwin.

Any small utilities used mainly from the command line usually end with C:\programs\bin, but for everything that I seriously plan to use on several computers, I usually create a real Windows installer with InnoSetup and let it be installed in C:\Program Files.

+2
source

http://ss64.com/bash/alias.html

eg.

alias progname=/path/to/program/progname
+2
source

Source: https://habr.com/ru/post/1761613/


All Articles