how to execute a.out file without commanding like ./a.out in Unix

execute, g++, gcc, solaris, ubuntu

Solution

It sounds, like the PATH variable has been set to include the home directory at your schools PC. You see, each time you enter a command without a path, it searches your entire PATH (which can consist of multiple paths) for something that matches the filename you supplied and executes the first thing it finds.

Check this link for some instructions: http://www.troubleshooters.com/linux/prepostpath.htm

Either you do a temporary fix, with

PATH=$PATH:/data/myscripts

or you edit the hidden file `.bash_profile` in your home directory for a more permanent fix.

I hope this helps.

Problem

I want to execute c++ binary in terminal without inputting "./a.out", just typing "a.out" In my school's PC(solaris10), I can just type a.out and the program executed. However, on my PC's solaris11 doesn't accept just "a.out". I believe there is a way to make it possible. If you know, please tell me. If possible, I want to know the instruction fo solaris, Ubuntu and macOS X, because I usually use Ubuntu and mac. Thanks in advance!!

Original source