How to create your own script (sh) on Linux MintSection: Other | Actuality: Unspecified
Let's create the most that neither is a simple script-shl to update the system. And then I'll show you how to add useful scripts to your system for convenient use.
First of all, let's understand what is script and what is it for.
We all watch movies, many of us - performances. To create a movie/show, the writers write the scripts to them on the basis of which actors, scene for scene perform on stage their roles. Work on creating a script rather laborious, where it is necessary to consider all the details that in the end, the artists were able to perform the intended writer, and the viewer saw a complete work.
Similarly, to write scripts to perform tasks the user is together (code) to make their implementation easier and faster in the operating system. For writing simple scripts does not necessarily have education as a programmer.
First, let's create the most that neither is a simple script-Shell to update the system.
So, open a text editor and enter in it the first must-have characters called shebang.
Next, the following line should be a description of what needs to run our first script:
#My first Script for update Linux Mint
Next, the script followed by running the line command, in this case to update the system:
sudo apt update sudo apt upgrade -y
y - short for yes
Save the file/script and give it a Name with a required extension at the end .sh. Extension .sh is assigned to the executable file.
I gave it a Name - update.sh preserving the Home folder of the user.
To create a file/script was executable, you must give him permission to do so. This can be done in two ways.
Run the following command in the terminal:
sudo chmod +x update.sh
Or right click on file => Properties => Right and activate the item - Execute: Allow executing file as a program:
run the sh script:
You can find the Internet useful scripts and use them in the system.
To use it easier to use some scripts, you can assign keyboard shortcuts to launch them or you can use hot corners.
If you add the script to the shell of your file Manager will probably need a restart.
May the Force be with you,