Featured Post

Taking inputs from user in a script

Here we will see how to take input from user in a script with the help of read command. #!/bin/bash Lets try multiplication of two numbers which the user enters. What read does is ? It takes values by user on stdin. It prompt the user to input any value on stdin. -p is used to display a prompt. read -p "First number:" value1 This will give a prompt as " First number " and store the value in variable " value1 " echo Will display a blank line. read -p "Second number:" value2 This will give a prompt as " Second number " and store the value in variable " value2 " echo Will display a blank line. read -sn1 -p "Press any key to see the answer..." Just to make it bit more interactive lets add one more thing. -s means silent mode that is if any value is pressed it will not be displayed on the screen like as in the password. -nX means how many characters. X here is one that is any

Introduction to Linux Shell

Shell is a program that takes commands from the keyboard and gives them to the operating system to perform actions accordingly.

Mostly Linux operating system has a application called Bash (aka Bourne Again SHell, which is an enhanced version of the original Bourne SHell.

There are several additional shell programs available on a Linux system such as ksh, csh, tcsh etc.

There are various "terminal emulators" available. Basically these are the programs that helps to interact with the shell. For instance xterm, konsole, gnome-terminal. You can get this launched via your utilities or programs menu.

Your terminal will look somewhat like given below:

[root@sunny-workstation ~]# 
or
[sunny@sunny-workstation ~]$ 

This means USER@HOSTNAME PWD followed by # or $ if you are logged in via root then it will show # otherwise for every normal user it will state $.

In above example root/sunny are the users, sunny-workstation is the hostname and ~ means their home directory.

Comments

Popular posts from this blog

Merging of various commands

Positional parameters in Bash scripting

Sourcing a variable