Operating System - HP-UX
1753262 Members
4973 Online
108792 Solutions
New Discussion

Re: amount of positional parameters

 
SOLVED
Go to solution
Marko Virtanen
Trusted Contributor

a mount of feeded parameters

Hi everyone

Why this is not working? Script confuse 1 and 10 parameters. What to do?

Script parameters:
IP=$1
comm=$2
message=$3
severity=$4
category=$5
origEvent=$6
target=$7
subject=$8
cardNumber=$9
Instance=$10


Output looks like this:
CardNumber is 1
IPaddress is test.net
Instance is test.net0


Many thanks,
Marko
Marko
3 REPLIES 3
Mark Grant
Honored Contributor
Solution

Re: a mount of feeded parameters

There are only nine positional parameters available to a script. you'll have to "shift" to get the last one so replace your "Instance=$10" with "shift;Instance=$9"
Never preceed any demonstration with anything more predictive than "watch this"
Marko Virtanen
Trusted Contributor

Re: a mount of feeded parameters

Hi

I was thinking that, but I could not believe it!

Marko

Ps. I would test it now.
Marko
Dennis Handly
Acclaimed Contributor

Re: amount of positional parameters

>There are only nine positional parameters available to a script.

 

If more than one digit, you can use ${10}.