这就是我所看到的:
1>------ Build started: Project: xxx (xxx\xxx), Configuration: Debug Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB4018: The "VCMessage" task failed unexpectedly.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB4018: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB4018: at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB4018: at System.String.Format(IFormatProvider provider, String format, Object[] args)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB4018: at Microsoft.Build.Shared.ResourceUtilities.FormatString(String unformatted, Object[] …Run Code Online (Sandbox Code Playgroud) 使用$@一个bash内test表达产生奇怪的结果.
这里有一个最小的测试脚本来重现问题(在相同的测试,其中:替代配方中做通无误差):
#! /bin/bash
# file path: ./bash_weirdness.sh
echo "args: '$@'"
echo "--- empty ---"
if test "" ; then echo "1.A1.TEST - not empty?"; fi
if test -z "" ; then echo "1.A2.EMPTY - empty?"; fi
if test -n "" ; then echo "1.A3.NE - not empty?"; fi
if ! test "" ; then echo "1.B1.NOT.TEST - empty?"; fi
if ! test -z "" ; then echo "1.B2.NOT.EMPTY - not empty?"; fi
if …Run Code Online (Sandbox Code Playgroud)