gpt4 book ai didi

linux - Bash - 从零开始的 Linux,cheching 库脚本

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:48:34 27 4
gpt4 key购买 nike

我读了 LSF 并看到了一些操作,描述了一个我没有找到。

请告诉我这是什么意思:

lib{gmp,mpfr,mpc}.la

完整代码 list :

cat > library-check.sh << "EOF"
#!/bin/bash
for lib in lib{gmp,mpfr,mpc}.la; do
echo $lib: $(if find /usr/lib* -name $lib|
grep -q $lib;then :;else echo not;fi) found
done
unset lib
EOF

bash library-check.sh

来源:LFS - Host System Requirements

最佳答案

这是一个通配符模式。它导致 shell 将该行扩展为

for lib in libgmp.la libmpfr.la libmpc.la; do
# ...
done

更多关于 shell 扩展和通配符模式的信息:http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html

从那里拿第一个例子,你可以自己在命令行上试试效果:

$ echo sp{el,il,al}l
spell spill spall

关于linux - Bash - 从零开始的 Linux,cheching 库脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34286501/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com