Difference between tcsh and bsd-csh in terms of use of square brackets in echo

35 Views Asked by At

I have two simple Shell scripts that essentially do the same thing (i.e., printing all arguments), as are shown below.

S1:

#!/usr/bin/tcsh
echo [$argv[*]]

S2:

#!/usr/bin/bsd-csh
echo [$argv[*]]

S1 runs OK on Ubuntu as a tcsh script:

% ./S1 a b
[a b]

But S2 fails on Ubuntu as a bsd-csh script:

% ./S2 a b
echo: No match.

I know S2 can be fixed by a pair of double quotes around [$argv[*]], yet I'd like to know what leads to the different results in tcsh and bsd-csh. If possible, please provide links to documentation that help explain cause of the different results. Thanks in advance.

0

There are 0 best solutions below