LibreOffice 编译时依赖需要 graphite, 而graphite的编译又依赖pkg-config。但是不想使用homebrew或者 MacPorts,喜欢下载源码自己编译。 pkg-config编译成功后,并且指定了环境变量。 然而make总是报checking for bogus pkg-config... configure: error: yes, from unknown origin. This *will* break the build. Please modify your PATH variable so that $PKG_CONFIG is no longer found by configure scripts.
diff --git a/configure.ac b/configure.ac
index 99ccaf54f748..dbb727422dec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7099,7 +7099,8 @@ if test $_os = Darwin; then
if test -z "$($PKG_CONFIG --list-all |grep -v '^libpkgconf')" ; then
AC_MSG_RESULT([yes, accepted since no packages available in default searchpath])
else
- AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please modify your PATH variable so that $PKG_CONFIG is no longer found by configure scripts.])
+ # AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please modify your PATH variable so that $PKG_CONFIG is no longer found by configure scripts.])
+ echo here ;
fi
fi
fi
fl.txt文件
12
34
56
78
Bash
1、IFS定义分隔符,默认空格、tab、换行、回车
bash-3.2$ a="a b c d"
bash-3.2$ for i in $a;
> do
> echo $i","
> done
a,
b,
c,
d,
bash-3.2$ b=`sed 'r/g' fl.txt`
bash-3.2$ for i in $b; do echo $i","; done
12,
34,
56,
78,
a="a,b,c,d"
#换行符分割
IFS=$'\n'
bash-3.2$ a="a,b,c,d"
bash-3.2$ for i in $a;
> do
> echo $i;
> done
a,b,c,d
设置分隔符为逗号
bash-3.2$ IFS=$','
bash-3.2$ for i in $a; do echo $i; done
a
b
c
d
2、使用分割符生成数组
bash-3.2$ aa="hello,shell,split,test"
bash-3.2$ array=(${aa//,/})
bash-3.2$ for i in ${array[@]}
> do
> echo $i
> done
Helloshellsplittest
bash-3.2$ array=(${aa/\n/,/})
bash-3.2$ for i in ${array[@]}; do echo $i; done
hello
shell
split
Test
bash-3.2$ echo ${array[0]}
hello
bash-3.2$ echo ${array[1]}
Shell
Zsh
Zsh 不会默认使用空格、tab、换行、回车分割
1、(f)按行分割
str=$(<fl.txt)
% echo $str
12
34
56
78
for i (${(f)str}){
echo $i"#"
}
12#
34#
56#
78#
注意,写在一起这样不行
for i (${(f)$(<fl.txt)});
do
echo $i",";
done
12 34 56 78#
直接输出和使用变量行为不一致
echo $(<fl.txt)
12 34 56 78
aa=$(<fl.txt)
echo $aa
12
34
56
78
需要使用(s:chr:)方式
for i (${(s: :)$(<fl.txt)});
do
echo $i",";
done
或者使用sed读取
aa=`sed 'r/g' fl.txt`;
for i (${(f)aa});
do
echo $i",";
Done
2、(s:chr:)
s='foo,bar,baz'
#仅s也可,见过p w @,:可以用其他符号代替
for i in ${(ps:,:)s} ; do
echo "$i END"
done
foo END
bar END
baz END
awk
bash-3.2$ aa=`awk '{print $1}' fl.txt`
bash-3.2$ for i in $aa
> do
> echo $i
> done
12
34
56
78