Hi,

I'm still pretty new to c++ programming in Fedora Core. I've successfully done up my c++ code and it can run when i did:
gcc -o test test.c
./test

However, is there a way which i could run this test file from any directory? For example, u can run ip6tables from any directory after installing it. I've tried looking for it online for quite some time now, but to no avail.

Thanks and Regards,

KiaN

You should copy test to a folder in your PATH variable, or add the folder that contains test to the PATH variable.
Refer the Adding to PATH variable section in this link.

You should copy test to a folder in your PATH variable, or add the folder that contains test to the PATH variable.
Refer the Adding to PATH variable section in this link.

Thanks! it worked =)

KiaN

> You should copy test to a folder in your PATH variable,
This is a really, no REALLY bad idea.

1. There is already a standard unix command line utility called 'test', so by just copying it to somewhere in your PATH you risk either deleting it, or masking it with your program because it's earlier in the PATH.

2. If you really want a collection of your own stuff, then create a $HOME/bin directory for your own programs, then adjust your PATH accordingly (ideally, append $HOME/bin to the end of the current PATH).

commented: Thanks. +7

> You should copy test to a folder in your PATH variable,
This is a really, no REALLY bad idea.

1. There is already a standard unix command line utility called 'test', so by just copying it to somewhere in your PATH you risk either deleting it, or masking it with your program because it's earlier in the PATH.

Thanks for the heads up. I know next to nothing about the UNIX utilities.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.