![]() ![]() ![]() In such a case, it would be better to create a script with the same root privileges, if the script executes commands that require root privileges. Name it whatever you would like, but remember how you typed the name because we are going to be using that exact name in the terminal. Select Format from the Menu and then click Make Plain Text. If the script does something that requires root privileges, then the script should be created with root privileges and run later with root privileges.Ī user script in which commands with “sudo”, ie with root rights, must be executed does not make much sense. In this tutorial, we will look at how to create a script and run scripts in the bash shell. Once you have written the script, you have to convert the document into plain text. If the script should do something that is relevant for a particular user, then the script should also be created and executed with the user rights. What is better now? A script with root or user rights? It depends on what the script does. In the second variant without “sudo” the file is created with the rights of the currently logged in user. To write a script in Script Editor Launch Script Editor in /Applications/Utilities/. ![]() I am creating the project in my home directory. Choose a place where you want to create a new directory and follow the steps below. touch script. You can do so easily using the touch command. Of course, the rights can be changed later. The first step is to set up the projects directory structure. To get started with scripting, create a new file with the extension '.sh'. The difference is that the first command creates the file with root privileges and thus can only be changed and executed with root privileges. ![]()
0 Comments
Leave a Reply. |