PDA

View Full Version : Command line arguments



achuth
January 15th, 2012, 05:46 AM
Sir,
I have read in a text book that positional-parameters (command line argument) can be from $0 through $9.
But when I tried more than $9 it is working. I used ${10},${11} and so on. What is the maximum number of command line arguments that we can give to a shell program?

Bachstelze
January 15th, 2012, 07:21 AM
It is shell- and platform-dependent. POSIX does not say anything about that as far as I can see. In Bash on Ubuntu the answer is "more than you will probably ever need".

Telengard C64
January 15th, 2012, 07:57 AM
There are other shells besides Bash, and not all of them support pp's greater than $9. Some of the tutorials you find with Google are written for older shells like sh.

http://www.gnu.org/software/bash/manual/bashref.html#Major-Differences-From-The-Bourne-Shell