1

I have installed executable files for BACI compiler and interpreter in my Ubuntu system.

But now every time I have to compile my .cm file I have to go to the program folder and run ./bacc and ./bainterp.

Can anyone tell me how to set environment variables for these programs, so that I can use them like by simple typing bacc / bainterp from any directory (just like we use gcc)?

  • Thanks for finding a duplicate question for this! But I guess the answer is not what I asked for. I am still confused where is my answer out of any of the responses posted there? How to use bacc as a command in terminal? – ikis Feb 5 '15 at 21:23
  • This seems like a duplicate to me; maybe I don't understand. If you add the program folder to your path, you can run bacc and bainterp without needing to provide the full path or switching to the directory to run them as relative paths – Michael Mrozek Feb 5 '15 at 21:44
  • @MichaelMrozek I have tried. That didn't work. If this helps to answer my question, then I want to draw an analogy between this with the Java Compiler and interpreter - Suppose you have tar out a java package in linux. then how would you set the path for java and javac commands to use them universally? – ikis Feb 5 '15 at 22:10
  • You put them on your path, that's how it works. Run which java in your terminal and you'll get the absolute path. Then run echo $PATH and you'll see a colon-delimited set of paths, which will include the directory java is in. Any executable in any of those directories will be runnable just using its name – Michael Mrozek Feb 6 '15 at 1:35
  • Okay! I have got echo $PATH correct, but then nothing works. I have rechecked it with the directory. the command just doesn't run. But it runs from its current directory. – ikis Feb 6 '15 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.