Example of Positional Parameters Assignment Help

Assignment Help: >> Shell Programming - Example of Positional Parameters

Practice 1

The following shell program display how to implement the positional parameters.

# cat > pscript

echo "The command is $0"

echo "The First argument is $1"

echo "The Second argument is $1"

echo "The Third argument is $1"

echo "The Fourth argument is $1"

# chmod u + x pscript

#./ pscript a b c d

The command is pscript

The First argument is a

The Second argument is b

The Third argument is c

The Fourth argument is d

In the given program, the pscript (filename) is $0 and the parameters are a, b, c and d are represented by $0,$1,$2 and $3 correspondingly.

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