Read command - The read command allows you to prompt for input and store it in a variable. shell allows to prompt for user input. Syntax: read varname [more vars] or read –p "prompt" varname [more vars] words entered by user are assigned to varname and “more vars” last variable gets rest of input line.
Posts
Showing posts with the label File System
In Linux (Shell), there are two types of variable: (1) System variables - Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS. (2) User defined variables (UDV) - Created and maintained by user. This type of variable defined in lower letters. Shell variables - var refers to the name, $var to the value - t = 100 #Sets var t to value 100 - echo ”$t = $t” #will print: $t = 100 - Remove a variable with unset var - Names begin with alpha characters and include alpha, numeric, or underscore
A shell script is a computer program designed to be run by the Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. A shell usually interprets a single line of input, but we can also create a file containing a number of lines of commands to be interpreted. This file is a program known as a shell script. The program can also contain control structures (if-then, loops). Shell scripts allow a sequence of commands to be executed automatically .