Learn to Code via Tutorials on Repl.it!

← Back to all posts
Why use BASH?
JordanDixon1 (443)

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!

Coder100 (15356)

Why g++ for c++?
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
JordanDixon1 (443)

@Coder100 g++ just compiles the code before use.

Coder100 (15356)

why isn't it c++ though? That's what I see on the c++ compiler i think @JordanDixon1

JordanDixon1 (443)

@Coder100 You could try and see if it works and i'll edit the post.

Highwayman (1457)

@Coder100 it’s the GNU c compiler with some of the flags set basically. So they just changed the name from gcc to g++.

Highwayman (1457)

Interesting tidbit: putting #!/path/to/language/interpreter will allow you to run things like they are normal executables in the terminal. I think.


print("hello! ")


chmod u+x main.py ; ./main.py
SixBeeps (4729)

Here's one for C#:

mono file.cs
CrazyVideoGamez (3)

um ok... honestly just use a .replit

LerieTaylor (0)

for C# on windows, "c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe"

JordanDixon1 (443)

@LerieTaylor Yes but were talking about bash on repl.it.