Shell Script

Interview Questions on Shell Script

6. How to execute shell script files?

 sh filename.sh

7. What are the conditions to write an variable name?

syntax: 
bash    your-script-name
sh       your-script-name
./your-script-name

Examples : 
$ bash   bar
$ sh   bar
$ ./bar
8. What are all the types of variables?
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.

9. How to define User defined variables (UDV) ?

Syntax:  
variable name=value
NOTE: Here 'value' is assigned to given 'variable name' and Value must be on right side = sign.

10. How to set readonly variables?

Use readonly
  $ readonly PI=3.14

www.000webhost.com