How to run .sh file from console
Question:
Answers:
You need to mark it as an executable program with chmod +x launch.sh
, or alternatively execute it with bash: bash launch.sh
I think the command would be sh launch.sh
@Wouter De Coster solve the problem, anyway i´ll try to add a bit more information.
Console Method
Setting Area
To use ./
function, the file must have execute permission on the script.
use chmod +x launch.sh
to set that permissions.
Run Area
Try to use ./launch.sh
again.
Another options to execute them:
sh launch.sh
bash launch.sh
GUI Method
Setting Area
- Select the file using mouse
- Right-click on the file
- Choose properties
- Click Permissions tab
- Select Allow executing file as a program:
Run Area
Click the file name and you will be prompted. Select Run in the terminal
and it will get executed in the terminal.
Once you changed the properties you can use the Run methods used in Console Method
#EXTRA
You can run .sh file and use debugging options, For example:
To debug shell script. It print commands and their arguments as they are executed.
bash -x launch.sh
To show shell input lines as they are read:
bash -v launch.sh
You need to mark it as an executable program with chmod +x launch.sh
, or alternatively execute it with bash: bash launch.sh
I think the command would be sh launch.sh
@Wouter De Coster solve the problem, anyway i´ll try to add a bit more information.
Console Method
Setting Area
To use ./
function, the file must have execute permission on the script.
use chmod +x launch.sh
to set that permissions.
Run Area
Try to use ./launch.sh
again.
Another options to execute them:
sh launch.sh
bash launch.sh
GUI Method
Setting Area
- Select the file using mouse
- Right-click on the file
- Choose properties
- Click Permissions tab
- Select Allow executing file as a program:
Run Area
Click the file name and you will be prompted. Select Run in the terminal
and it will get executed in the terminal.
Once you changed the properties you can use the Run methods used in Console Method
#EXTRA
You can run .sh file and use debugging options, For example:
To debug shell script. It print commands and their arguments as they are executed.
bash -x launch.sh
To show shell input lines as they are read:
bash -v launch.sh