Why use BASH?
Bash can be used for multiple things. However, the most notable is that it can be used to rename your index file into anything. for example:
If I have a python file named ree.py I can easily set up a way to run that specific file. Amazing right? Want to learn how to do it? Let's jump in then!
First things first:
Make a new bash repl. Once you have done that erase the first line of code it should be something like:
echo Hello World
Once you erased that make your new python file and write whatever you want to write down in python syntax.
Once you're done with writing your python file go to the main.sh and type:
python (name of python file).py
replace the (name of python file) with your name of the python file.
Now for c++ there is a little extra work involved but the same premise.
do the same thing but instead of writing a python file write a c++ file. Then go to the main.sh and type in:
g++ (name of your file).cpp -o (name of your file) ./(name of your file)
The first line compiles the code and write the compilation into a file named the name of your file without any extension. Then the second line runs it. Remember that on the second line you don't need the extension and will pop up an error.
That's all for now. If you want another on how to do this with any other language, I'll do some research and see if it's possible. -Cya!
I'll contribute one! Node.js
npm init -y # to install a package, do npm install [package] --save # to start, do npm install && node index.js
Interesting tidbit: putting
#!/path/to/language/interpreter will allow you to run things like they are normal executables in the terminal. I think.
#!/usr/local/bin/python print("hello! ")
chmod u+x main.py ; ./main.py