For bash, installed in almost all operating systems, Linux, has a very developed system of commands that allows to develop scripts , having rich functionality.Similar scenarios are used in Linux-systems everywhere.Run the bash-script can be by setting the appropriate attributes and having the necessary permissions.
- - account on the target machine;
- - perhaps the right root.
Make console log on to the machine where the script should be executed.Start a terminal emulator (konsole, XTerm, etc.) or switch to a text console by pressing one of the shortcut keys Ctrl + Alt + Fx.If there is no physical access to your computer, connect it to the network using the ssh-client (eg, PuTTY for Windows or ssh for Linux).If you want to enter your account details.
Change to the directory that contains the script file.This is done for the convenience of further work.Use the cd, a parameter which must be an absolute or relative path to the target directory.For example: cd / h
ome / tmp / You can also use a file manager such as Midnight Commander.
Change the permissions on the script, if necessary.Make it executable and editable with your account.If you are the owner of the file, then run the command chmod, change the rules.For example: chmod 0755 ./test.shEsli owner of the file is a different user, or temporarily set the right 0777 by typing chmod using sudo, or change the owner and group using chown (also from sudo).If you use a file manager, such actions can be much easier to make with it (in the Midnight Commander is the appropriate menu items File).
Review and, if necessary, edit the script, stating in its first line the path to the interpreter bash after the characters # !.Use your preferred text editor.For example, vim editor or Midnight Commander.Save the modified script file.
Run the script bash.Enter the console absolute or relative path to the directory with the script file's name, and the parameters, if required.Press ENTER.