asked in Software by (8.2k points)
0 like 0 dislike
8 views

How I can to run shell or bash script, i.e. execute file with .sh extension? Me need execute command for run shell script in Linux terminal/console (command line).


how to run sh script

1 Answer

0 like 0 dislike
answered by (8.2k points)

Open a terminal and navigate to the folder where the .sh file is located. Then type any from below strings:

sh <filename>.sh
bash <filename>.sh
./<filename>.sh

For example:

./script.sh

The terminal has a rich set of powerful tools that are accessible by typing the commands. You need locate the .sh file by typing ls and cd. Once you are in the correct current folder you can run the script like this:

./script.sh

Or you can run and redirect the output to a file:

./script.sh > out.txt

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

Related questions

0 like 0 dislike
1 answer 7 views
0 like 0 dislike
1 answer 7 views
0 like 0 dislike
1 answer 6 views
0 like 0 dislike
1 answer 7 views
0 like 0 dislike
1 answer 8 views
0 like 0 dislike
1 answer 27 views
0 like 0 dislike
1 answer 26 views
...