正如我将展示的那样,这个问题隐含地要求单行输出。
测试.bat
@SET JARS=^
./lib/apache-mime4j-0.6.jar;^
./lib/apache-mime4j-0.6.jar;^
./lib/bsh-1.3.0.jar;^
./lib/cglib-nodep-2.1_3.jar;^
./lib/commons-codec-1.6.jar;^
./lib/commons-collections-3.2.1.jar;^
./lib/commons-exec-1.1.jar;^
./lib/commons-io-2.0.1.jar;^
./lib/commons-io-2.3.jar;
@echo %JARS%
输出
c:\home\Steven\Desktop>test.bat
./lib/apache-mime4j-0.6.jar;./lib/apache-mime4j-0.6.jar;./lib/bsh-1.3.0.jar;./li
b/cglib-nodep-2.1_3.jar;./lib/commons-codec-1.6.jar;./lib/commons-collections-3.
2.1.jar;./lib/commons-exec-1.1.jar;./lib/commons-io-2.0.1.jar;./lib/commons-io-2
.3.jar;
测试.sh
JARS=\
'./lib/apache-mime4j-0.6.jar;'\
'./lib/apache-mime4j-0.6.jar;'\
'./lib/bsh-1.3.0.jar;'\
'./lib/cglib-nodep-2.1_3.jar;'\
'./lib/commons-codec-1.6.jar;'\
'./lib/commons-collections-3.2.1.jar;'\
'./lib/commons-exec-1.1.jar;'\
'./lib/commons-io-2.0.1.jar;'\
'./lib/commons-io-2.3.jar;'
echo "$JARS"
输出
$ ./test.sh
./lib/apache-mime4j-0.6.jar;./lib/apache-mime4j-0.6.jar;./lib/bsh-1.3.0.jar;./li
b/cglib-nodep-2.1_3.jar;./lib/commons-codec-1.6.jar;./lib/commons-collections-3.
2.1.jar;./lib/commons-exec-1.1.jar;./lib/commons-io-2.0.1.jar;./lib/commons-io-2
.3.jar;