Reputation: 77
I need to handle more than 10 parameters in script. I was declaring and assigning after 9th parameter like below.
param10=${10}
param11=${11}
param12=${12}
It is working fine in linux, but not in solaris. I am getting bad substitution
Can any one help me to read paramters more than 10 and that should work for both solaris and linux.
Upvotes: 0
Views: 846
Reputation: 10346
Maybe out of date, but according to this link:
The Bourne shell only supports positional parameters $0 through $9. In order to access parameters 10 or greater, you must use the "shift" command. Shift will move $2 to $1, $3 to $2, etc. ($0 is the name of the command being invoked and never shifts). Also, you can shift more than one position at a time. For example, you can use $1 through $9, then issue the command "shift 9" and process variables 10 through 19 using the variables $1 through $9 again.
Upvotes: 3