Well...thanks all the people that tried to answer my question but i found the answer myself. So if you are trying to find the answer to this question, look no farther than this.
First a little bit of clarification. All .sh scripts can be made to run bash commands. You just have to add the SHEBANG line to do so.
The SHEBANG line specifies which application will be used to run the script. This application can be anything from Python to Bash.
To make the script run with bash what we do is type this at the starting of the script:
#!/bin/bash
Now that we've added the SHEBANG line, all of the lines in this script will be run as bash commands.
Next, we can simply add the commands that we wanted to execute. Now the script will be looking something like this:
#!/bin/bash
cd searxng-docker
sudo docker-compose up -d
Now there is a simple change we CAN make to make the script a little bit more efficient. If you look at the cd
line, you can see that we are cd-ing into the searxng-docker
folder. This means that the cd
command is pointing to the relative location of the folder. This is bad as if we are in any other directory than our home directory, the cd command will not work.
To fix this, we have to replace the cd searxng-docker
command with the cd /home/<your-username>/searxng-docker
command. Don't forget to replace the <your-username>
with your real username.
Now, just one problem remains. Making the script executable.
To do this, type in the terminal: chmod +x ./<your-script-name>
and again, replace <your-script-name>
with the name of the script you created.
Now your script is ready and you can execute it by right-clicking on the script and choosing "Run as a program" or by typing ./<your-script-name>
in the terminal, again replacing <your-script-name>
with the name of the script you created.