Executing files with Bash


Is it possible to execute files with Bash? If so, how do I do it?

The language of the file matters. If you’re using Python, you can run it with

python [file].py

If you need to run any other languages, don’t hesitate to tell me!


If your file is an executable, you can use ./[file]

If your file is bash script, you can use bash [file] or sh [file]

Most languages have a command to run the script, such as:
Python: python [file]
C (compile, need to use ./ later): gcc -o [output file] [file]
even brainf**k have a command to run bf script using yabi [file]

For other languages, just search how to run [language] in terminal online, you can add in Ubuntu or in linux at the end of the u want

If you can’t find a command you think is suitable for your language, you can always find a template using that language, use the template, show hidden files, and use the command from run variable

Note: if it says you have no permission to execute a file, try use chmod +ax [file]
Change all [bracketed keyword] appeared here to what described inside
Unless not specified you should always include the file extension with the filename

1 Like

@OmegaOrbitals @TaokyleYT How can I run HTML, React and NodeJS on Bash?

Try this:

nix-shell -p elinks --run "elinks file.html"

I can’t think of a way to do that one.

Try this:

node file.js

They both won’t work. The NodeJS one gives an error, and the HTML one does show an actual webview

What error do you get?

main.sh: line 1: node: command not found

For some reason it also happens for the python one too.

Add pkgs.nodejs-18_x and pkgs.python39Full to replit.nix.

You can type the exact command in shell and it may try to find it in nix env, allow u to install the package/code into your repl

However for those 3, it is much better to use it’s official template when creating a repl, so that it will have a default replit subdomain, code for holding a replit subdomain with the code you got, and pre-set output window

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.