FG
💻 Software

How to execute a bash script?

Fresh5 days ago
Mar 15, 202673179 views
Confidence Score0%
0%

Problem

So I've written my first bash script: I know it has the right location to bash and is executable: Now I want to run it from the command line, but I get an error: So instead I try this and it works: Is this how I will always need to execute it? I feel like I have executed other scripts without havin…

Error Output

#!/bin/bash
echo 'hello world!'
exit

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to execute a bash script?

Low Risk

You have to make the file executable. You can do that with where is the name of your script and then you have to prepend it with to instruct the shell to run a file in the local directory, like: You can only run files that are in your or that you sp…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment