[PATCH v2 1/1] syntax-highlight: when the file has no extension, assume text

Christian Franke nobody at nowhere.ws
Thu Apr 5 11:38:47 CEST 2012


On 04/04/2012 07:07 PM, Ferry Huberts wrote:
> On 04-04-12 18:58, Lukas Fleischer wrote:
>> There is no "==" in POSIX shell/test(1). This should probably be a
>> single equal sign ("=").

> it appears there is, or (if there is not) the line above also doesn't
> work (that line has been in since 56522eb, 19-11-2009)

$ cat << EOF > test.sh
if [ "magic" == "\$1" ]; then
    echo "Argument is magic."
fi
EOF
$ /bin/dash test.sh
[: 3: magic: unexpected operator
$ /bin/dash test.sh magic
[: 3: magic: unexpected operator
$ sed -e 's/==/=/' -i test.sh
$ /bin/dash test.sh
$ /bin/dash test.sh magic
Argument is magic.
$ /bin/bash test.sh
$ /bin/bash test.sh magic
Argument is magic.

dash is a posix compatible shell. As most people use bash as their
shell, incompatibilies with posix shell often go unnoticed for a long
time. A script should however either specify /bin/bash as interpreter
or adhere to the shell language given in POSIX.

Best Regards,
Christian




More information about the CGit mailing list