Shell – Are there shells that supports typed variables and multidimensional arrays

shellvariable

Is there a shell that supports distinguishing between variable types and multidimensional arrays?

At a minimum, it should distinguish between Strings, Integers, Floats and Doubles.

The following commands should be different. command 1 and command "1" if variable types were supported. Notice it would be similar to a c function like fun(1) and fun("1"). Alternatively it should have 2 separate syntaxes for shell and calling functions.

Best Answer

Perl Shell supports three types of variables: scalars, lists, and hashes.

Perl Shell (psh) combines aspects of bash and other shells with the power of Perl scripting.

and

The Perl Shell is a shell that combines the interactive nature of a Unix shell with the power of Perl. The goal is to eventually have a full featured shell that behaves as expected for normal shell activity. But, the Perl Shell will use Perl syntax and functionality for control- flow statements and other things.

It doesn't so much distinguish between Strings, Integers, Floats and Doubles[1], as seamlessly convert between them as needed, exactly as Perl does.

It's difficult to see any reason why a shell would need to distinguish between a number 1 and the string "1" in any situation where auto-coversion was the Wrong Thing To Do, or where different operators for string vs numeric vs regexp comparison didn't suffice. Much like bash or other shells do.

[1] See specialist modules like Math::BigFloat if special handling of float types is required. or Math::Bigint for very large integers.