如何在我的bash脚本中优化for循环?(不能在此发布,因为它是38k字符,限制为30k)https://bpaste.net/raw/a1fdc8614bda
因为它似乎需要花费更长的时间来循环遍历阵列(超过3分钟)
这段代码是为了搜索提供数组,找不到任何在notfound数组中提到的东西tbh,自从我上次处理这段代码后我已经记不清它是如何工作的了
$ time ./print_not_found
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] libltdl not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg-turbo not found and is not current provided by any packages aquired in this instance
[WARNING] libncursesw.so not found but is provided by ncurses-6.0+20170902-3-x86_64.pkg.tar.xz
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[WARNING] libgl not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[WARNING] shadow not found and is not current provided by any packages aquired in this instance
[WARNING] libgl not found and is not current provided by any packages aquired in this instance
[WARNING] libglade not found and is not current provided by any packages aquired in this instance
[WARNING] libglvnd not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg-turbo not found and is not current provided by any packages aquired in this instance
[WARNING] libltdl not found and is not current provided by any packages aquired in this instance
[WARNING] libx264.so not found and is not current provided by any packages aquired in this instance
[WARNING] pygobject not found and is not current provided by any packages aquired in this instance
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[WARNING] vulkan-driver not found and is not current provided by any packages aquired in this instance
[WARNING] java-environment not found and is not current provided by any packages aquired in this instance
[WARNING] libfreetype.so not found but is provided by freetype2-2.8.1-1-x86_64.pkg.tar.xz
[WARNING] libgl not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg-turbo not found and is not current provided by any packages aquired in this instance
[WARNING] libltdl not found and is not current provided by any packages aquired in this instance
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] libltdl not found and is not current provided by any packages aquired in this instance
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[WARNING] libltdl not found and is not current provided by any packages aquired in this instance
[WARNING] opencl-icd-loader not found and is not current provided by any packages aquired in this instance
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] java-runtime not found and is not current provided by any packages aquired in this instance
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[WARNING] libjpeg not found and is not current provided by any packages aquired in this instance
[WARNING] sh not found but is provided by bash-4.4.012-2-x86_64.pkg.tar.xz
[NOT FOUND (29)]
libjpeg
libltdl
libjpeg
libjpeg-turbo
libgl
libjpeg
shadow
libgl
libglade
libglvnd
libjpeg
libjpeg-turbo
libltdl
libx264.so
pygobject
vulkan-driver
java-environment
libgl
libjpeg
libjpeg-turbo
libltdl
libjpeg
libltdl
libltdl
opencl-icd-loader
libjpeg
java-runtime
libjpeg
libjpeg
real 3m31.837s
user 2m20.949s
sys 1m30.562s