Shell Program to shift the parameter Assignment Help

Assignment Help: >> Advanced Shell Scripts - Shell Program to shift the parameter

Practice 1

The given shell program lists parameters which are passed to the program, with the number of the parameter.

# vi whileparam count=1

while [ -n "$*" ]

do

echo "This is parameter number $count $1"

shift

count='expr $count + 1'

done

# sh while 1 2 3 4 5 6

This is parameter number 1 1

This is parameter number 2 2

This is parameter number 3 3

This is parameter number 4 4

This is parameter number 5 5

This is parameter number 6 6

The above program will accept the arguments and show the respective position of every argument or parameter. In the program the shift command has been used to shift the parameter to next position.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd