PID TTY TIME CMD
5866 pts/0 00:00:00 bash
BASIC SHELL SCRIPT FOR ECHOING :
There are many editors like nano,vi,gedit you can use any of those I would suggest using vi because it has advanced functionality and you won't have to switch later on.So keep practicing using vi.
So lets begin:
STEP 1 :open the editor type at the terminal prompt typing the following command:
$ vi echoText.sh
This will start a new .sh file to write a shell script .
STEP 2 : Now you have to press i to get into insert mode so that you can start typing (without this you won't be able to type)!
STEP 3 : type the following shell script .You can copy paste from below to see how the first script works
#! /bin/bash # Note the hash symbol is used for comment in shell script # the first line has to be as shown (don't worry I will tell you later why)
echo "Hello you are reading this super awesome blog on linux ~ TECHLAVYA "
#echo command is used for reflecting what you type within double quotes on the screen
STEP 4 : save the file and exit vi
this can be done by pressing the escape key (esc) and then typing semicolon (:) and then w and then q
ie :wq (Note: this will appear at the bottom of the terminal screen)
STEP 5 : give file permission by typing in the terminal
chmod u+x echoText.sh
STEP 6 : run the shell scripts by typing in the terminal
./echoText.sh
OUTPUT will be :
Hello you are reading this super awesome blog on linux ~ TECHLAVYA