PATH
determines where executables are searched; it has no influence on where source files are searched. Source files without a directory component are searched in the current directory anyway. What you have to write to compile main.c
depends on the compiler used, which you didn't specify, but it's usually like cc main.c
. Also consider using make
rather than writing a shell script.
Edit PATH by adding current directory. To compile a *.c file without by typing a filename without "./"
-
28-08-2022 - |
Frage
I added this line:
PATH=.:$PATH
to my .bash_profile
.
Now I have to make main.c
compile when I type zz
(under the same directory in ~/user/filename
)
- What do I have to write in the
zz
shell script? - Did I add the current directory correctly?
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow