I am new to Ubuntu and I just started learning bash.
How can I open bash files through terminal?
Asked
Active
Viewed 1.6e+01k times
8
muru
- 193,181
- 53
- 473
- 722
Elian Kamal
- 761
- 2
- 7
- 11
4 Answers
10
To edit:
Use any editor you like:
gedit some_file.sh
nano some_file.sh
vim some_file.sh
# ...
To run:
Either make it executable and run it giving the path:
chmod +x some_file.sh
./some_file.sh
Or tell bash to run it:
bash some_file.sh
2
Give it permission to run
chmod +x /path/to/yourscript.sh
And run your script:
/path/to/yourscript.sh
Avishek Saha
- 507
- 3
- 13
2
Make it executable using
chmod +x filename
and run it in terminal using
./filename
Or
You simply
bash filename
g_p
- 18,154
- 6
- 56
- 69
2
To open a bash file for editing (something with an .sh suffix) you can use a text editor like nano.
nano filename.sh
If you want to run a bash script you can do it in several ways.
./filename.sh
or
sh filename.sh
Best, Lev
levlaz
- 833
- 5
- 11