LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I make it so I don't have to type './$filename' run compiled C++ progs (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-make-it-so-i-dont-have-to-type-%24filename-run-compiled-c-progs-300957/)

Nalorin 03-12-2005 10:10 PM

How do I make it so I don't have to type './$filename' to run compiled C++ progs
 
Hey, all...

I'm just curious... I know that I have to do this in the /etc/bashrc file, but I don't know what I need to do exactly.
I tried to put in there:

alias $filename="./$filename"

but it didn't work - says './' is unrecognized... What I'm trying to do is have it so that I don't have to type in the . / before every binary file that I want to run, after compiling it from C++, for school

i.e.

process:

kwrite <filename>.cc &
#write code in C++ language
#save file

make <filename>
# then to execute the file
./<filename> #(without spaces)

#I want to type:
<filename> #(not 'dot-slash-<filename>')


can anyone help me in editing my /etc/bashrc file to do so, please:Pengy:

Matir 03-12-2005 10:17 PM

Try this in your .bashrc:
Code:

PATH=$PATH:.
This will add your current working directory to your PATH (where the shell searches for executables). Placing it at the END is the preferred way to avoid bugs and security issues.

Nalorin 03-12-2005 11:12 PM

ok, will do.... thx!

- If it doesn' t work: then, to quote Arnie - "I'll be back" :P


All times are GMT -5. The time now is 12:33 PM.