Re: a mount of feeded parameters (365 Views)
Reply
Trusted Contributor
Marko Virtanen
Posts: 223
Registered: ‎07-14-2003
Message 1 of 4 (365 Views)
Accepted Solution

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
Honored Contributor
Mark Grant
Posts: 2,712
Registered: ‎04-01-2003
Message 2 of 4 (365 Views)

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"
Trusted Contributor
Marko Virtanen
Posts: 223
Registered: ‎07-14-2003
Message 3 of 4 (365 Views)

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
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 4 of 4 (362 Views)

Re: amount of positional parameters

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

 

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

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.