Search your topic here

Shell script parameter passing

SHELL SCRIPT
Shell scripts are text files in which commands are written.
To create shell script example is as shown below,
$vi profjayesh.sh
Shell are interactive, which means shell accept commands from you via keyboard and execute them.
But when we needed to execute shell command more than one , then we use shell script to write loops.
CREATING SHELL SCRIPT:
To create shell script we will use ‘vi editor’, as shown below-
$ vi Parameter_pass_shellscript.sh
In ‘Parameter_pass_shellscript.sh’ file we write the below command
$ Symbol ahead 1, 2, 3 shows that 1 ,2 and 3 is variable, so $ is used to create variable.
To run the above file the command used will be-
‘sh Parameter_pass_shellscript.sh  21  22 23
21  22  23 is input here for the variable $1, $2, $3 respectively.
As shown below-

LEAVE A REPLY