bash中的多行分配

前端之家收集整理的这篇文章主要介绍了bash中的多行分配前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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中进行这样的多行分配?

正如我将要展示的那样,这个问题隐含地要求单行输出.

test.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;
原文链接:https://www.f2er.com/bash/383697.html

猜你在找的Bash相关文章