How Do I Run a Bash File in Linux
Create a New File Called Demo. Sh Using a Text Editor Such as Nano or Vi in Linux: Nano Demo. Sh. Add the Following Code: #! /Bin/Bash. … Set the Script...
Create a new file called demo.sh using a text editor such as nano or vi in Linux: nano demo.sh.Add the following code: #!/bin/bash. … Set the script executable permission by running chmod command in Linux: chmod +x demo.sh.Execute a shell script in Linux: ./demo.sh.
How do I run a Bash script in Linux?
- Create a new file called demo.sh using a text editor such as nano or vi in Linux: nano demo.sh.
- Add the following code: #!/bin/bash. …
- Set the script executable permission by running chmod command in Linux: chmod +x demo.sh.
- Execute a shell script in Linux: ./demo.sh.
How do I run a Bash script from the command line?
BASH will be available in the Command Prompt and PowerShell. Open Command Prompt and navigate to the folder where the script file is available. Type Bash script-filename.sh and hit the enter key. It will execute the script, and depending on the file, you should see an output.