Shell script is a text file that contain a series commands for a Unix-based operating system . Firstly we need an editor like Vim, to install vim
1 |
remotekernel@RemoteKernel:~$ sudo apt-get install vim |
As you know vim is a programmer editor . To open a vim text file write to console
1 |
remotekernel@RemoteKernel:~$ vim file_name |
For writing to editor: type “a”, now you can write to editor and to exit from the editor press ESC then write “:wq” this means write and quit. You can more info here.
https://help.ubuntu.com/community/VimHowto
Let’s start to write first Shell Script
Open your editor.
1 |
remotekernel@RemoteKernel:~/Desktop/zone$ vi script_1 |
After writing script, I will set to script execute permission.
1 |
remotekernel@RemoteKernel:~/Desktop/zone$ chmod 755 script_1 |
now I will execute.
1 |
remotekernel@RemoteKernel:~/Desktop/zone$ ./script_1 |
to be continued..