6

I'm a long time Windows user and how I usually do this in Windows is to edit the environment path and add the file path to the command that I want to use. Like when I want to use PHPUnit I just add this path to the environment variables:

tools/phpunit/vendor/bin/phpunit

And then I can just use phpunit file_test.php to run my tests. How do I do that in Ubuntu?

1 Answer 1

8

Add the complete path of phpunit to ~/.bash_profile like this

export PATH=$PATH:tools/phpunit/vendor/bin/phpunit

Thats it :)

Make sure that you are adding the complete path of phpunit. This is same as setting the environment variable PATH in Windows. $PATH will retain the values of PATH variable and we are just appending the location of phpunit to it.

**If the ~/.bash_profile is not present you can add the line at the end of ~/.bashrc.

7
  • thanks! but where do I find this bash_profile? May 19, 2013 at 5:04
  • Open a terminal by Ctrl+Alt+T. Type gedit ~/.bash_profile. In the editor which opens up, add that line, with the complete path to phpunit and save it. May 19, 2013 at 5:26
  • For me it had to be path to directory not a file.
    – Esamo
    Aug 16, 2014 at 18:11
  • @heemayl your edit is badly formatted (** at the beginning of the last line), can you please fix it?
    – A.L
    Apr 7, 2015 at 9:47
  • @A.L: I have added that line as a caveat..the ** are not for bold-ing, those are there for indicating a note.
    – heemayl
    Apr 7, 2015 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .