-1

So typically a program with an argument is invoked in the following way:

./helloworld -test

I've been asked to invoke a C program in command-line simply by typing:

helloworld test

In other words, without the "./". I should be able to launch my program in a Unix command-line just as I would "ls". The tools I currently have (that I am aware of) at my disposal to make this happen are Makefile and argv[], but I can't find any questions or documentation on the internet relevant to this particular problem.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • 2
    You can execute a program by name if the directory where the program is located is in the `$PATH`. – EOF Feb 04 '17 at 10:22
  • 1
    Do an `export PATH=${PATH}:./` prior to running your program. – alk Feb 04 '17 at 10:23
  • Possible duplicate of [Why do you need ./ (dot-slash) before script name to run it in bash?](http://stackoverflow.com/q/6331075/1072229) – Grisha Levit Feb 04 '17 at 10:24

1 Answers1

0

Make sure that the PATH variable contains the ./ directory (or better the full path), to run the program without specifying the directory.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190