Unit 1 LP
Unit 1 LP
)
1. Vi/VIM editor
Vim editor is one of the most used and powerful command-line based editor of
the Linux system. By default, it is supported by most Linux distros. It has enhanced
functionalities of the old Unix Vi editor. It is a user-friendly editor and provides the
same environment for all the Linux distros. It is also termed as programmer’s
editor because most programmers prefer Vi editor. Vi editor has some special
features such as Vi modes and syntax highlighting that makes it powerful than
other text editors. Generally, it has two modes:
Command Mode: The command mode allows us to perform actions on files. By
default, it starts in command mode. In this mode, all types of words are
considered as commands. We can execute commands in this mode.
Insert Mode: The insert mode allows to insert text on files. To switch from
command mode to insert mode, press the Esc key to exit from active mode and ‘I’
key.
To invoke the vi editor, execute the vi command with the file name as follows:
vi <file name>
Shell responsibilities (Contd.)
Pipeline Hookup
Just as the shell scans the command line looking for redirection
characters, it also looks for the pipe character |. For each such
character that it finds, it connects the standard output from the
command preceding the | to the standard input of the one following
the |. It then initiates execution of both programs.
So when you type
The above example does not print anything. You cannot use the
unset command to unset variables that are marked readonly.
Shell variables (Contd.)
Variable Types
When a shell is running, three main types of variables are present −
•Local Variables − A local variable is a variable that is present within
the current instance of the shell. It is not available to programs that
are started by the shell. They are set at the command prompt.
•Environment Variables − An environment variable is available to
any child process of the shell. Some programs need environment
variables in order to function correctly. Usually, a shell script defines
only those environment variables that are needed by the programs
that it runs.
•Shell Variables − A shell variable is a special variable that is set by
the shell and is required by the shell in order to function correctly.
Some of these variables are environment variables whereas others
are local variables.