I want to create a file which contains some commands (suppose 4 commands) such that when I click on that file, the commands will executed in terminal. Is it possible ? I am using Ubuntu 14.04 LTS. Thanks in advance !
Asked
Active
Viewed 67 times
2 Answers
0
you must create a file using your favourite text editor in the following fashion
#!/bin/bash
your commands here
The first line (I believe it is called magic line) ensures that the following commands are executed in the shell. After creating this file you have to give it executable permission: right click on file -> properties -> permissions -> tick the checkbox at the bottom. Now by double-clicking your commands should be executed. Please note that for commands containing 'sudo', additional work is required

G H
- 1
-
Replace 'magic line' with 'shebang'. – Videonauth May 25 '16 at 22:06
0
Yes, it is possible. Make two files, let's call the first one main.sh
and the second one sub.sh
.
In main.sh
put the following lines:
#!/bin/bash
gnome-terminal -x "./sub.sh"
In sub.sh
put the code you want to execute.
Be sure to make both files executable. Then double-click main.sh
.

anonymous2
- 4,298