Your Only Destination To Empower Your Computer Programing Knowledge. Sky is not so high, You can Touch it if You Try

How to write script in Vi Editor

Hello Friends,
In previous article i discussed a brief introduction of Unix/Linux operating system.In this article i will show you how to write a script in vi editor.
Firstly we should know what is editor? Editor is for editing in a files.When we create a file in unix then through editor we can modify file.Mainly 3 editors used in Unix.
1. Ed editor
2. Ex editor
3. Vi Editor
Ed editor used in previous time on command line.It works on line number.Then after it ex editor comes into picture.Now a days Vi editor is used for writing script.it was first editor to display file on whole screen.
In unix file can be created through a command:-
cat > filename
contents of file................
................
ctrl+d
Now if we want to edit content of file created by Unix/Linux ,we can use vi editor.
How to use vi editor:-
In Vi editor there is three modes:
1. command mode
2. Insert mode
3. Ex command mode

We can write script in insert mode.For editing through Vi editor :-
1. Firstly vi filename and press enter key.

2.Now select position at which you want to modify through commands h,j,k,l.
3. Press i for insert mode and carry out modification.
4. save changes through command by firstly press Esc for command mode and then Shift+z or ZZ.
if You write a script then you can execute that script by writing on command prompt:-
sh filename and press enter
Ok friends ,i hope you get something from this.i will Explain you how to write script through example in next article.Stay in touch..................
Thank you.

No comments:

Post a Comment