在
Windows上的.cmd文件中我做:
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;
如何在shell中进行这样的多行分配?
正如我将要展示的那样,这个问题隐含地要求单行输出.
原文链接:https://www.f2er.com/bash/383697.htmltest.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;
test.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;