I'm passing a variable to a script on the command line. What is the character limit of a command? eg:
$ MyScript reallyreallyreally...reallyreallyreallylongoption
The shell/OS imposed limit is generally very long - usually one or two hundred thousand characters.
Scripts are likely to permit this full length, but it is not unlikely that other utilities will impose their own limits either intentionally or through design issues. There may also be artificial limits to how long an individual argument on a long command line can be, and/or how long a path to a file can be.
Do you mean what is the longest variable length? To figure that out you can use perl's "x" to create a very long variable name:
On My system 131071 works:
and the variable is printed at 131072 it's too big: